We have discovered that latest version of Aspose.Words (20.10.0) doesn’t render a header within a section. Version 15.11 did it fine.
Please find attached sample Word document (expected content) and input WordML.
missed_header_in_section.zip (14.9 KB)
The document contains 2 sections, headers and “different first page” option enabled (this option is not necessary, just for demonstration that first page header displayed, but regular header is not). As a result of generation we can see that regular header at section 2 was disappeared. It is unexpected behavior, and it was working fine in previous Aspose.Words 15.11.
Could you please advise any workaround for this (we can’t refuse section due to document structure) and when it will be fixed? Thank you in advance.
@Vitaly_Filatenko,
I have converted “document_sample.xml” to DOCX format by using following code with both 15.11 and 20.10 versions of Aspose.Words for .NET on my end and attached them here for your reference:
Document doc = new Document(@"C:\missed_header_in_section\\document_sample.xml");
doc.Save(@"C:\missed_header_in_section\20.10.docx");
I am afraid, I do not visually see any difference in MS Word 2019 on my end. Please create and attach a comparison screenshot which highlights the problematic area(s) in this Aspose.Words 20.10 generated DOCX (with respect to MS Word 2019 or Aspose.Words 15.11 generated DOCX files). Please also provide any additional steps that you think might be required to reproduce this issue on my end. I will then investigate the issue further and provide you more information.
I’m also don’t see differences on your outputs (Word 2016).
But unfortunately on my side header is missing on 3rd page:
image.png (10.0 KB)
OutputResults.zip (32.2 KB)
I did almost the same steps to get these files:
var doc = new Document(inFile);
doc.Save(outFile, SaveFormat.Docx);
@Vitaly_Filatenko,
The problem simply occurs because you are using Aspose.Words for .NET in evaluation mode without applying license. Please apply license before performing any document processing tasks. Hope, this helps.
You’re right. When I set a license, the issue disappeared.
This topic was created when I tried to create simplified document to highlight another customer’s backward compatibility issue (related to headers in document’s section). I thought that I caught it, but obviously it is not.
So, I will try to create simplified document again and will create new topic when it will be ready. Sorry for disturbing.
@Vitaly_Filatenko,
Sure, please let us know if you may have any troubles and we will be glad to look into this further for you.
I was able to create simplified document and reproduce the issue: truncated_test.zip (18.6 KB)
But I suppose that I can foresee your answer, because I tried to load this xml from Word and it was rendered like Aspose.Words 20.10 renders. 
So, do we have any possibility to get more backward compatibility in latest Aspose, or we should only recommend our customers to recreate their xml templates if something is not working as it was before?
@Vitaly_Filatenko,
We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-21339. We will further look into the details of this problem and will keep you updated on the status of the linked issue. We apologize for any inconvenience.
@Vitaly_Filatenko,
Regarding WORDSNET-21339, please check the following analysis details:
The current behavior of Aspose.Words is fine. However, the XML document you provided has some problems. Here is the structure of XML document:
<w:p>
<w:pPr>
<w:sectPr>
skipped headers/footers
skipped properties
</w:sectPr>
</w:pPr>
</w:p>
<w:sectPr>
skipped properties
</w:sectPr>
<w:p/>
Another section
<w:p>
<w:pPr>
<w:sectPr>
skipped headers/footers
skipped properties
</w:sectPr>
</w:pPr>
</w:p>
<w:sectPr>
skipped properties
</w:sectPr>
<w:p/>
This is clearly written in the documentation (ISO_IEC_29500-1_2011 17.6.17)
Consider a document with multiple sections. For all sections except the final section, the sectPr element is stored as a child element of the last paragraph in the section. For the final section, this information is stored as the last child element of the body element
As a workaround, please try to just change headers footers by using the following code :
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToSection(1);
builder.CurrentSection.HeadersFooters.LinkToPrevious(false);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);
builder.Write("this is the first header for the second section");