> I am thinking of replacing in my database-based
> application the StyledTextCtrl with RichTextCtrl,
mostly to
> be able to paste images, tables etc... My problem is,
the
> data for RichTextCtrl is stored inside the database, so
I
> cannot use LoadFile on it. I also don't think I could
use
> SetValue() or AppendText(), as these methods do not
hold
> formatting informations about the saved text. Is there
a way
> in which I could load the text, formatting, images and
so on
> from the database and assign it to the RichTextCtrl?
>
> Sorry for the dummy question, I have never used
RichTextCtrl :-D
>
Forgive me if I send you in the wrong direction - what I
have done in
the past is use the base64 module to encode the original
file to a
cStringIO stream. You will end up with a long stream of
characters
(similar to email attachements and mime encoding) that are
quite safe
for storing in the db.
To retreive and load the file, read the string back from the
db, decode
it and store it as a temp file then load the temp file into
the
RichTextCtrl. When done editing, reverse the process.
Of course you will want to remove the tempfile on exit too
!
I am not familiar with the controls mentioned, but hope that
helps.
Hope that helps.
G.
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|