We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Margin Issue While convert Word to HTML and HTML to Word

Hello While Converting Word to HTML and HTML to Word we losing some margin so due to that our File is going to 75 pages to 100 Pages.
as in the Below snapshot that , Date is goes on Next page its done on every time so can you please help me to work on this?

image.png (85.8 KB)
Below having the image for the Word to HTML
image.png (29.9 KB)

below is the code for the HTML to Word
image.png (23.8 KB)

Please help us to resolve this issue as soon as possible

@bhavikahirr Please, attach the source document here we will check the issue and provide you more information.

There have multiple task in them so i already share that chunck of code screenshort to you .
if you need that code then i can provide to you.

My code file and uploaded file is as below
Form_File.zip (1.1 MB)

@bhavikahirr Please, first of all, inform what goal you are trying to achieve with Docx -> Html -> Docx conversion chain. The fact is that Html format does not save PageSize and PageMargin at all, and with such conversion the values ​​​​of these attributes will be converted to the default ones. This format is not suitable for this purpose.
Next, I open “Proposal-ef6878a8-a3c0-4b33-bbbb-51b1c74562a2.docx” attached by you in MS Word 2019 and I see not 75 pages, but 106 ones. After conversion the number of pages becomes 100, but this is not due to PageMargin loss, but because of wrong attributes of the table on page 28 of the original document.

Hello I apologize that i was attached the wrong file…
Please check this one for the Round trip of Word to HTML and HTML to Again Word.

Template.docx (1.8 MB)

as i attached the Last file once you converted to this file for the round trip you can see the first page that Date and Version will go into the Second page… and Image will be not in proper manner

please guide us that how to resolve that issue… hence we are working on live development and if its proper fixed and same file retrieve as uploaded then we have to buy and move to the license version else need to check any other alternative

@bhavikahirr Please note that you have not clarified what the ultimate goal of Docx -> Html -> Docx conversion is. Unfortunately, it is impossible to achieve full compliance with the layout of the initial and final Docx (if this is your goal) with such conversion.

I open “Template.docx” sent by you in the last post and “Proposal-ef6878a8-a3c0-4b33-bbbb-51b1c74562a2.docx” sent in the post before last, and I don’t see the date that goes on the next page. I see PageMargins default values ​​set for the reason I mentioned above.
convert.png (140.4 KB)

In addition to losing PageMargins values, your original document contains revisions and comments with different formatting, and their print view is very different from how it is displayed in MS Word, and this view also affects pagination. You can see yourself by saving to Pdf in MS Word (this is how you will see the print view of comments and revisions; such print view is emulated by Aspose.Words output).
All this greatly affects the layout of the output Docx obtained after Html -> Docx conversion.
Unfortunately, you will not be able to get an identical output Docx for a given input “Template.docx” with any conversion other than Docx -> Docx, no matter which tool you use: Aspose.Words, MS Word or some third option.

This is a “Proposal management” project
We need to import the word document to our application
the document will be sliced into sections to be assigned for different team members
at the end we need to re-generate the word document to be sent for the customer

so the flow will be as following
1- user will import word document
2- edit word in HTML editor inside the application
3- regenerate back the final word document

@bhavikahirr The best result that I managed to achieve as a result of the Docx -> Html -> Docx chain was with the following settings.

HtmlSaveOptions options = new HtmlSaveOptions
  HtmlVersion = HtmlVersion.Html5,
  ExportFontsAsBase64 = true,
  CssStyleSheetType = CssStyleSheetType.Embedded,
  ExportImagesAsBase64 = true,
  PrettyFormat = true,
  ExportPageSetup = true,
  TableWidthOutputMode = HtmlElementSizeOutputMode.None,
  ExportHeadersFootersMode = ExportHeadersFootersMode.FirstSectionHeaderLastSectionFooter

Please note that some of the options that are not used when displaying in Html format are stored as metadata and are used only to implement roundtrip.