MirrorMargins in ODT not saved correctly

I have a DOCX template with mirror margins (MirrorMargins) configured. I populate the template using Aspose.Words’ built-in ReportingEngine with the following code:

csharp

ReportingEngine engine = new ReportingEngine();
Document doc = new Document(templatePath);
engine.BuildReport(doc, model, "model");

The mirror margins are correctly applied during the filling process. During debugging, I can see that the section properties (Section) have the value PageSetup.MultiplePages = MultiplePagesType.MirrorMargins, confirming that the mirror margins are properly set in the document.

Additionally, I tested creating a new document using DocumentBuilder, where the mirror margins are also set via PageSetup.MultiplePages. In both cases, the mirror margins work correctly during generation.

In my understanding, mirror margins are alternating margins applied to odd and even pages. This means that on odd pages, the left margin is larger and the right margin is smaller, while on even pages, it is the reverse. When saving the document as PDF or RTF, the mirror margins work perfectly, displaying correctly. However, when saving the document as ODT, they are not reflected in the file: the styles.xml file lacks the critical node style:page-usage="mirrored", which is responsible for rendering mirror margins in ODT.

Perhaps I am misunderstanding something, and mirror margins need to be configured differently for ODT. If so, I would greatly appreciate clarification or guidance.

@Nikita_Sugak

Could you please clarify if you have tried any specific configurations for mirror margins when saving as ODT, or if you have encountered any error messages during the process?

No errors occur during the saving process; it completes successfully. However, the mirror margins are not reflected in the resulting ODT file.

:one: I am using a DOCX template with mirror margins (MirrorMargins) already configured. The template is populated using the ReportingEngine mechanism.

:two: I have also attempted saving the document in ODT format via MemoryStream using:

csharp

doc.Save(memoryStream, SaveFormat.Odt);

:three: Additionally, I tested saving the document with OdtSaveOptions:

csharp

var options = new OdtSaveOptions();
doc.Save(memoryStream, options);

In these tests, I experimented with various settings in options, such as:

csharp

options.IsStrictSchema11 = true;

:four: Moreover, I manually re-applied the parameter:

csharp

section.PageSetup.MultiplePages = MultiplePagesType.MirrorMargins;

:five: I also added empty sections to the document for verification purposes:

csharp

var section = new Section(doc);
doc.Sections.Add(section);

Despite all these steps, the mirror margins are still not saved correctly in the resulting ODT file. The critical node style:page-usage="mirrored" is missing from styles.xml, indicating that mirror margins are not being implemented in the ODT format. However, when saving the document as PDF or RTF, the mirror margins work perfectly and display as expected.

If there are any further recommendations or clarifications on how to properly configure mirror margins for ODT format, I would greatly appreciate your guidance. Perhaps I am missing a vital parameter or step necessary for this.

@Nikita_Sugak
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28131

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like