Loading a .doc file to wx.TextCtrl

Hi all,

How do I load a .doc file onto a wx.TextCtrl using the wx.TextCtrl method LoadFile( ).?

Kindly help.

Thanks in advance.

I’m pretty sure you can’t. From what I’ve read, LoadFile is for loading text files. You’re welcome to try, but I suspect you’ll just get a bunch of gibberish. If you convert it to rich text, then I think you could load it, assuming you have your TextCtrl in rich text mode. See python - wx.TextCtrl.LoadFile() - Stack Overflow for more info.

  • Mike
···

On Tuesday, June 19, 2012 7:07:09 AM UTC-5, Spondita wrote:

Hi all,

How do I load a .doc file onto a wx.TextCtrl using the wx.TextCtrl method LoadFile( ).?

Kindly help.

Thanks in advance.

How do I load a .doc file onto a wx.TextCtrl using the
wx.TextCtrl method LoadFile( ).? Kindly help.

First, depending on your needs, you might consider a more complex text
editor control, such as the wxRichTextCtrl or the wxStyledTextCtrl. They
are a lot more powerful than the wxTextCtrl. (I've used both and prefer the
wxRichTextCtrl, at least for my project.)

Second, you'll need to write a parser to translate between the control
you're using and the file format you want to support, unless you can find
one that someone else wrote. As an example, you might want to look at the
preliminary RTF parser I wrote for the RichTextCtrl at
Transana.com | Qualitative Analysis Software For Researchers .

If you get something working, please be sure to share it with the list. I
know I'd be interested in using it.

David

David K. Woods, Ph.D.
Researcher, Transana Lead Developer
Wisconsin Center for Education Research
University of Wisconsin, Madison
http://www.transana.org