|
-
May 22nd, 2006, 02:48 PM
#1
Thread Starter
New Member
[02/03] assistance requested - Extract image from RTF stream
Has anyone extracted or fetched a image/metafile from an RTF stream. Either parse the RTF stream, or using the RichTextBox Control? I know how to insert metafiles/images, extract text, including unicode.....
I've attempted to use rtb.control.count - this returns zero. The rtf file in question contains 28 images. These images need to be programmitcally extracted, not manually extracted.
-david
-
May 22nd, 2006, 04:53 PM
#2
Re: [02/03] assistance requested - Extract image from RTF stream
I started working on this for you, and this is as far as I got:
VB Code:
Dim reg As New System.Text.RegularExpressions.Regex("\{\\(pict)\\(((.)|(\n))[^\}])*")
Try
For Each str As System.Text.RegularExpressions.Match In reg.Matches(Me.RichTextBox1.Rtf)
Stop
Next str
Catch ex As Exception
Stop
Finally
End Try
From here, I think it gets a little more involved (determining image types, placing them into streams, attempting to export them into indiv files). This will atleast give you the encoding informtation for the images.
-
May 23rd, 2006, 10:53 AM
#3
Thread Starter
New Member
Re: [02/03] assistance requested - Extract image from RTF stream
Thank you for your assistance. Perhaps I should have stated the problem a little more clearly.
I do not have difficulty parsing the text from the rtf stream. ie: Searching for '\pict', finding rtf keywords, groups, etc..
The rtf doc contains 28 images, I can find \pict 28 times, sometimes the rtf control word \metafile is found.
Questions:
Do you know how the \pict data terminates?
The file in question was created with word2003. I understand word2003 writes a second set of image data for downward compatiblity with older rtf readers, do you kow how this data stream is tagged?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|