Hi, i’m trying to implement a simple conversion from rtf to doc.
For input, i’m using a xtrareport from devexpress, then exporting it to rtf into a memory stream.
I’m trying to convert this stream to a doc.
But i get the attached error.
Screenshot 2023-03-03 162405.png (20.6 KB)
Screenshot 2023-03-03 162413.png (8.9 KB)
The code to convert:
private byte[] GetBinaryContent(XtraReport report, ReportFormats format)
{
using (var mem = new MemoryStream())
{
//some ifs...
else if (format == ReportFormats.Doc || format == ReportFormats.Docx)
{
report.ExportToRtf(mem);
_mem = mem;
var getDocStream = new SaveDocumentStream(GetSaveFileStream);
_memToSave = new MemoryStream();
using (Converter converter = new Converter(GetFileStream))
{
var options = new WordProcessingConvertOptions
{
Format =
format == ReportFormats.Doc ?
WordProcessingFileType.Doc :
WordProcessingFileType.Docx
};
var possibleConversions = converter.GetPossibleConversions();
converter.Convert(getDocStream, options);
}
}
return mem.ToArray();
}
}
private Stream GetFileStream() => _mem;
private Stream GetSaveFileStream() => _memToSave;