I am very sorry to say I cannot find the solution for the past serval days
1. While loading, that is not so much difficult
2. While editing, my problem is: how to associate the local filename
with the image which I have just insert from a Openfile dialog? how to
associate the filename with the image which I have just
copied/cut/pasted?
I am using the official demo, but change the onFileViewashtml function a llitle
[======code begins=======]
def onFileViewashtml(self, evt):
handler = rt.RichTextHTMLHandler()
handler.SetFlags(rt.RICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES|rt.RICHTEXT_HANDLER_NO_HEADER_FOOTER
)
handler.SetFontSizeMapping([7,9,11,12,14,22,100])
stream = cStringIO.StringIO()
if not handler.SaveStream(self.rtc.GetBuffer(), stream):
return
streamvalue=stream.getvalue()
print streamvalue
[======code ends=======]
but I found after I copy a image, the streamvalue gives differnet fielnames:
[====output begins====]
<table border=0 cellpadding=0 cellspacing=0><tr><td width="100%"><font
face="MS Shell Dlg 2" size="2" color="#000000" ><p
align="left">Welcome
<p align="left"><p align="left"><img
src="file:/C%3A/DOCUME~1/MINI/LOCALS~1/Temp/image2.png" />
<p align="left"><p align="left"><img
src="file:/C%3A/DOCUME~1/MINI/LOCALS~1/Temp/image3.png" />
</font></td></tr></table><p>
[====output ends====]
as you can see, there are image2.png and image3.png, but in fact they
should both point to ONE file!
3. while saving, how can I get the text and the picturename in pre/post process?
if possible, can anybody show me some sample?
thanx again
···
5. Re: Re: sample code to custom wxRichTextFileHandler? (Robin Dunn)
Date: Tue, 24 Jun 2008 22:27:54 -0700
From: Robin Dunn <robin@alldunn.com>
Subject: Re: [wxpython-users] Re: sample code to custom
wxRichTextFileHandler?
To: wxpython-users@lists.wxwidgets.org
Message-ID: <4861D75A.2020900@alldunn.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowedoyster wrote:
> then is there any other method to load/edit/save html files(but keep
> the image as the link to a local file) in wxpython?You could pre/post process the html when loading/saving.