Pagination has an error

We are trying to convert a word document to html and the pagination is not being converted correctly. . This formula of the pagination has not been exported to the html file.

html file:

<td style="width:123.85pt; border-top:0.75pt solid #000000; padding-right:5.4pt; padding-left:5.4pt; vertical-align:top; -aw-border-top:0.5pt single">
<p style="margin:0pt -2.15pt 0pt 37.1pt; text-align:justify; font-size:8pt">
<span>Page </span><span style="-aw-field-start:true"></span><span style="-aw-field-code:' PAGE '"></span><span style="-aw-field-separator:true"></span><span>1</span><span style="-aw-field-end:true"></span><span> of </span><span style="font-weight:bold">!Syntax Error</span>
</p>
</td> 

@PTDLPPLRunTeam,

Can you attach the source document, please?

I cant do it because the source document has confidential information.

@PTDLPPLRunTeam,
Can you remove all confidential information? I do care about the structure, not the content. Just leave some random information that you can copy and paste from anywhere to keep the amount of pages.

yes, we’ve created a document that has the same issue for you to be able to reproduce it

.AC1 and 2 (2).docx (66.1 KB)

@PTDLPPLRunTeam,

I tried the convertion with this simple line:

doc.Save($"{PartialPath}_output.html", SaveFormat.HtmlFixed);

And it worked. I am attaching the input and output.

Please keep in mind I am using the latest version. 23.2.
FooterIncorrectlyRendered_input.docx (66.1 KB)
FooterIncorrectlyRendered_output.zip (4.3 KB)

we were using SaveFormat.Html and changed it to SaveFormat.HtmlFixed after your comments but got the following error {“An invalid SaveFormat for this options type was chosen.”} when trying to convert the document into html.

The options we are using are shown in the picture below.

image.png (17.2 KB)

@PTDLPPLRunTeam,

if you want to try HtmlFixed you need to use HtmlFixedSaveOptions.

@PTDLPPLRunTeam,

I made this sample code for you:

doc.UpdateFields();

var saveOptions = new HtmlFixedSaveOptions();            

saveOptions.Encoding = Encoding.UTF8;
saveOptions.PrettyFormat = true;
saveOptions.UpdateFields = true;

doc.Save($"{PartialPath}HtmlFixed_output.html", saveOptions);

The output:

FooterIncorrectlyRenderedHtmlFixed_output.zip (4.2 KB)

Hello, we cannot use HtmlFixedSaveOptions() because we need the other options we are currently using.

Aspose correctly exports the PAGE field, shouldn´t it be able to export the other field in the image below?

@PTDLPPLRunTeam Upon exporting to flow HTML, Aspose.Words exports only value of formula field. In your case combination of PAGE and formula fields is exported like this:

<p style="margin-top:0pt; margin-left:37.1pt; margin-bottom:0pt; text-indent:-13.8pt; text-align:justify; font-size:10pt">
	<span style="font-size:8pt; -aw-import:spaces">&#xa0;</span><span style="font-size:8pt">Page </span><span style="-aw-field-start:true"></span><span style="-aw-field-code:' PAGE   \\* MERGEFORMAT '"></span><span style="-aw-field-separator:true"></span><span style="font-size:8pt">1</span><span style="-aw-field-end:true"></span><span> </span><span style="font-size:8pt">of</span><span> </span><span style="font-size:8pt">1</span>
</p>

As you can see PAGE field is exported with roundtrip information and formula field is exported as simple text value:

<span style="font-size:8pt">1</span>

This is an expected behavior. Currently Aspose.Words preserve roundtrip information only for PAGE, NUMPAGES, NOTEREF, REF, AUTOR and TITLE fields.

The problem you have described in your initial post is not reproducible with the following simple code:

Document doc = new Document(@"C:\Temp\in.docx");
doc.Save(@"C:\Temp\out.html", new HtmlSaveOptions() { PrettyFormat = true });

out.zip (2.8 KB)

Hi,

Is there any public documentation about this that can be consulted?

@PTDLPPLRunTeam I have create a documentation task WORDSNET-25073 to add this information into the API reference and documentation.

hi, any news on the documentation?

@PTDLPPLRunTeam Unfortunately, the documentation is not updated yet. We plan to update it within a couple of months.