I have an RTF file with a content like this:
{\object\objemb{\*\objclass Excel.Sheet.12}\objw8415\objh3015{\*\objdata
01050000
02000000
0f000000...}}}
(may be Excel or Word)
What I need is to extract the \objdata
part into an external file to be able to edit it. After that, the file shall be converted back to an embedded object in an RTF file.
I already searched around, and it seems that this is not a trivial problem. From this post and with a small modification, I tried to get access to the objdata
and to save it to file, but this does not lead to a valid Excel file:
if (RtfReader.MoveToNextControlWord(enumerator, "objdata"))
{
byte[] data = RtfReader.GetNextTextAsByteArray(enumerator);
using (MemoryStream packageData = new MemoryStream())
{
RtfReader.ExtractObjectData(new MemoryStream(data), packageData);
File.WriteAllBytes(@"c:\temp\some-excel.xls", ReadToEnd(packageData));
}
}
Are there any ideas out there how to achieve the mentioned goals?
Thanks a lot in advance for any help!