Word to html - footers appearing randomly at wrong location

Hi ,
I have 2 questions. First, i am using Aspose.words to render docx file into html. I have a total of 23 pages in my word document. Each page has a header and footer. When i convert to html, i don’t see the header and footer. The only footer i see is for page 3 which appears in place of page 19. How do i go about fixing this issue. I need my html to be exactly similar to the docx file. I have tried converting to pdf and that works fine.
Secondly, in my html i am trying to add a watermark. For some reason, i see that watermark on first page and the rest of pages don’t have the watermark. Also the watermark is not behind content. Its becoming the first page of the document. I want it to appear on top of content on all pages. The snippet i have used for this is:

docBuilder.Document = document;
Shape watermark = docBuilder.InsertImage(@"C:\img\preview_placeholder.gif");
watermark.BehindText = true;
watermark.AllowOverlap = true;
watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
watermark.HorizontalAlignment = HorizontalAlignment.Center;
watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page;
watermark.VerticalAlignment = VerticalAlignment.Center;

Please help in this regard.

Thanks

I am generating html from doc. I want the html to be similar to the word document in appearence. I want the header and footer to appear in the right position. Currently the html i am getting doesn’t have footer in the right position. In a document of 19 pages, i see footer on the 13th page which shows page 3 of 3. I want to preserve styles of doc file. How do i go about solving this issue.

Thanks

Hi
Thanks for your request. This is an expected behavior. HTML document is one page document that is why header is shown only at the beginning of the HTML page.
By the way if your document contains multiple sections with header/footer, header will be displayed at the beginning of the section and footer at the end of the section.
https://reference.aspose.com/words/net/aspose.words.saving/exportheadersfootersmode/
The same about watermark – watermark in MS Word document is a shape inserted into header of the document so it appear on each page of the word document.
Best regards,

Thankyou for your quick response.

I am trying to show user a preview of his / her document. I thought an html version of the document would be good enough but since i am not able to generate the document as it was in docx how do i go about solving this ? what is the right way of showing a preview of the document with a watermark?

Hello

Thanks for your request. It is possible to create Document preview, for example by converting your document to image, XPS or SWF format. Especially, SWF format is interesting, because SWF file generated by Aspose.Words already includes document viewer UI. So you need just display the generated SWF file on your web page.

Document doc = new Document("C:\\Temp\\in.docx");
doc.Save("C:\\Temp\\out.swf", SaveFormat.Swf);

Also please see the following links:
https://blog.aspose.com/2009/08/14/render-doc-ooxml-odt-rtf-and-html-documents-in-silverlight/
Best regards,