RTF to RTF conversion moves page sizing and margin information from document level to per-section level

Hello,
I am using Aspose Words 17.9 (on an older license) but I have gotten the latest Aspose Words from NuGet (20.6) and was able to reproduce my issue as well.

My software uses Aspose Words to open RTF documents from a host system, make edits to the contents as Aspose Document objects, then saves the file as an RTF back to the host system.

For context, the RTF I am using for my testing has margins of 0.7" all around the document, and the defaults for RTF documents are 1.25" on left and right and 1" on top and bottom.

It appears that, by design, Aspose outputs this RTF with the page sizing and margin information on the section level for every section and omits it on the document level. On my original document, the sizing and margin information for the page appears just after the userprops meta data at the top of the RTF, and it looks like:

\paperw12240\paperh15840\margl1008\margr1008\margt1008\margb1008\gutter0

When the RTF gets output from Aspose, this is omitted and instead every section of the report gets a copy of this margin data, with no way to control the output so this appears on the document level instead. Here is a sample line from the output showing the per-section page sizing and margin info:

\pgwsxn12240\pghsxn15840\marglsxn1008\margrsxn1008\margtsxn1008\margbsxn1008\guttersxn0

Within Aspose, the Document shows the right margins in its PageSetup, but as far as I can tell, there is no way to insist that the formatting data be set for the document level instead or in addition to the per-section sizing.

This is a problem for our software because the RTF viewer we use expects the RTF to have document-level page sizing and margin information, and reverts to default values if it cannot find it, which results in a document where either some of the information is cut off due to margins or its otherwise “crowded together” in the case of tables. Further, if I open this RTF in the latest public release of Microsoft Word 365 (16.0.12827.20200) and change a single visible character and save it again, Word “fixes” the RTF so that the page sizing and margin information is again back on the document level and not on each section’s level, which leads me to think that Word also prefers the information to be on the document level.

I have attached two screenshots: in the first, a preview of the report in our application as it was generated by Word; in the second, a preview of the report after Aspose has converted RTF to RTF and moved the sizing information. I have also attached (in the ZIP file) the source RTF content for both reports, with the same numbering strategy (1 = before aspose, 2 = after aspose).

image.png (84.8 KB)

image.png (84.3 KB)

Aspose Support RTFs.zip (2.7 MB)

Is there a setting I have not noticed which will change the behavior of the RTF output from Aspose Words to work with my application? Is this change of RTF a deliberate choice, or should Aspose be outputting the page sizing and margin information on the document level in addition to the section level?

Thanks in advance,
Chris

@clunter,

While using the latest 20.6 version of Aspose.Words for .NET, we managed to reproduce this issue on our end and logged it with ID WORDSNET-20603. Your thread has been linked to this issue and you will be notified as soon as it will get resolved in future. Sorry for the inconvenience.

1 Like

The issues you have found earlier (filed as WORDSNET-20603) have been fixed in this Aspose.Words for .NET 20.8 update and this Aspose.Words for Java 20.8 update.