I succeeded in saving in Xml a RichTextCtrl document (to a database).
The demo OnFileViewHTML function helped.
Excerpts of the code is as follows:
handler = rt.RichTextXMLHandler()
handler.SetFlags(rt.RICHTEXT_HANDLER_INCLUDE_STYLESHEET)
import cStringIO
stream = cStringIO.StringIO()
if not handler.SaveStream(self.rtc.GetBuffer(), stream):
return
docToSave=stream.getvalue()
Then save to database...
But how to do the other way round, ie load the value retrieved from the database
to the RichTextCtrl ?
I tried to use the LoadStream function but without success...
Any idea?
Subsidiary question: for my correct understanding, don't you think that the
SaveStream function should be called SaveToStream ? Because that is what it
does, doesn't it ? In addition, I could only find this function in the New
wxpython online documents.
I succeeded in saving in Xml a RichTextCtrl document (to a database).
The demo OnFileViewHTML function helped. Excerpts of the code is as follows:
handler = rt.RichTextXMLHandler() handler.SetFlags(rt.RICHTEXT_HANDLER_INCLUDE_STYLESHEET)
import cStringIO
stream = cStringIO.StringIO()
if not handler.SaveStream(self.rtc.GetBuffer(), stream):
return
docToSave=stream.getvalue()
Then save to database...
But how to do the other way round, ie load the value retrieved from the database
to the RichTextCtrl ?
I tried to use the LoadStream function but without success...
I would expect it to work the same, once you've loaded the string to use for the stream into the StringIO.
Any idea?
Subsidiary question: for my correct understanding, don't you think that the
SaveStream function should be called SaveToStream ?
Only if SaveFile was called SaveToFile.
Because that is what it
does, doesn't it ? In addition, I could only find this function in the New
wxpython online documents.
Because it is called SaveFile in C++, there are two versions of the same function there. (It's call method overloading.)
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!