[python-win32] Converting HTML formatting to Microsoft Word

sharpblade sharpblade1 at gmail.com
Wed Jun 15 14:13:49 CEST 2011


Heh, thanks!
I dreamed of writing some nice recursive function, but I gave up and
moved to the HTMLParser module:
http://paste.pocoo.org/show/408125/

Its WIP at the moment but works nicely with bold, underline, italics
and bulletpoint lists. It was a lot nicer and more concise before I
found out that the WYSIWYG editor also outputs <span style="x"> to
format text as well as <strong> and <em>, so i'm hacking away at it to
get it to work with those.


On Wed, Jun 15, 2011 at 11:51 AM, Mark Hammond <skippy.hammond at gmail.com> wrote:
> On 14/06/2011 6:51 PM, sharpblade wrote:
>>
>> I whipped up this function: http://pastebin.com/kaZz5dBd which should
>> work, but line 22 and 23 doesn't work for some reason - all text after
>> it is bold.
>
> The last thing you do in those lines is set the range to bold - presumably
> later you then insert more text right at the end of the range - maybe word
> is just keeping the bold for the new text just like it would do if you where
> typing (ie, IIRC, if the cursor is at the end of a bold range, new text you
> type is also bold...)
>
> Or not - just a thought :)
>
> Mark
>


More information about the python-win32 mailing list