Docx to Html conversion missing header

When converting from Docx to Html the input file, there will be a missing header from the Html output.
This seems to happen only if the section break from the first page of the word document is present.

Sample code:

using (FileStream fs = File.OpenRead(Server.MapPath("/File") + "\\inputFile.docx"))
{
    var doc = new Document(fs);
    var saveOptions = new HtmlSaveOptions
    {
        ExportXhtmlTransitional = true,
        ExportRoundtripInformation = true,
        ExportHeadersFootersMode = ExportHeadersFootersMode.PerSection
    };
    doc.Save(Server.MapPath("/File") + "\\outputFile.htm", saveOptions);
};

Web app reproducing this issue:
WebApp.zip (185.2 KB)

@manikya.rao This is an expected behavior when continuous section break is used. You can reset section break to new page to get header/footer exported:

Document doc = new Document(@"C:\Temp\in.docx");

foreach (Section sect in doc.Sections)
    sect.PageSetup.SectionStart = SectionStart.NewPage;

var saveOptions = new HtmlSaveOptions
{
    ExportXhtmlTransitional = true,
    ExportRoundtripInformation = true,
    ExportHeadersFootersMode = ExportHeadersFootersMode.PerSection,
    PrettyFormat = true
};

doc.Save(@"C:\Temp\out.html", saveOptions);

But note, only primary header and footer are exported to HTML.

@alexey.noskov I have tried your suggestion with SectionStart.NewPage and I am still not able to see the primary header, which for the second section it is “Abbreviations”.

Aspose.Words Version: 21.10

@manikya.rao Thank you for additional information. I have managed to reproduce the problem and logged it as WORDSNET-23961. It looks like the problem is causes by Even page header. You can workaround this by resetting DifferentFirstPageHeaderFooter and OddAndEvenPagesHeaderFooter flags. Please try using the following code:

Document doc = new Document(@"C:\Temp\inputFile.docx");

foreach (Section sect in doc.Sections)
{
    sect.PageSetup.SectionStart = SectionStart.NewPage;

    sect.PageSetup.DifferentFirstPageHeaderFooter = false;
    sect.PageSetup.OddAndEvenPagesHeaderFooter = false;
}

var saveOptions = new HtmlSaveOptions
{
    ExportXhtmlTransitional = true,
    ExportRoundtripInformation = true,
    ExportHeadersFootersMode = ExportHeadersFootersMode.PerSection,
    PrettyFormat = true
};

doc.Save(@"C:\Temp\out.html", saveOptions);

@manikya.rao We have completed analysis of the issue and concluded to close it as Not a Bug. ExportHeadersFootersMode.PerSection exports primary (odd page) headers/footers, while only even page header and footer are visible in the source document. Aspose.Words doesn’t write headers/footers that are not visible in the source document, because it lacks layout information that is required for correct export in certain cases.