We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Words for .NET generates incorrect RTF for TextRange

I’m using the following code:

object Convert(System.IO.Stream stream)
MemoryStream ms = new MemoryStream();
Document doc = new Document(stream);
doc.Save(ms, SaveFormat.Rtf);
FlowDocument flowDoc = new FlowDocument();
TextRange tr = new TextRange(flowDoc.ContentStart, flowDoc.ContentEnd);
tr.Load(ms, DataFormat.Rtf);
return flowDoc;

When the loaded docx file contains header/footer, tr.Load throws “unrecognized structure in data format ‘Rich Text Format’. Parameter name: stream”.

.NET Aspose.Words version
Thanks for any assistance.


To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input RTF document.
  • Please attach the output RTF file that shows the undesired behavior.
  • Please attach the expected output RTF file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.