Wrong table height when converting HTML text to Docx

Hello,
I’ve been asked to evaluate your product to convert a piece of HTML text (this arrives from a WYSISWG HTML editor) to DOCX,

For what concern the text,files.zip (6.8 KB)
it’s ok…the messy goes when I have to convert a table, it became flat.

The snippet of code I’ve used is

Document

doc = new Document();

var str = File.ReadAllText("c:\\temp\\output.html");

DocumentBuilder documentBuilder = new DocumentBuilder();

documentBuilder.InsertHtml(str,true);

documentBuilder.Document.Save(@"c:\temp\out.docx");

}

What am I doing wrong?
Thanks

@advapi,

Thanks for your inquiry. Unfortunately, we have not found any issue with table’s height. Could you please share some more detail about your query? We will then provide you more information on it.

Excuse me, have you seen the out.docx file I’ve attached in previous post?.. html.PNG (1.0 KB)

See html.png , that’s the original HTML one
in docx.png you’ve the generated (wrong) ones

docx.PNG (4.3 KB)

@advapi,

Thanks for sharing the detail. MS Word 2016 renders the table correctly. Please check the attached image. output.png (30.9 KB). Please share the MS Word version that you are using to view the DOCX.

it’s just attached in the first zip

@advapi,

Please check the “output.png” in my previous post. MS Word 2016 renders the table correctly. Could you please share the viewer e.g. MS Word that you are using to view the DOCX? We will investigate the issue on our side and provide you more information.

For sure, here it’s from another pc

save.PNG (46.9 KB)

@advapi,

Thanks for sharing the screenshot. Please try following code example and use latest version of Aspose.Words for .NET 18.3. Hope this helps you.

Document doc = new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(doc);

documentBuilder.InsertHtml(File.ReadAllText(MyDir + "output.html"), true);

OoxmlSaveOptions options = new OoxmlSaveOptions();
options.Compliance = OoxmlCompliance.Iso29500_2008_Strict;
doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2016);
doc.Save(MyDir + "18.3.docx", options);

Hello,
No way… still got the same issue

image.png (29.7 KB)

@advapi,

Thanks for your inquiry. We have not found the shared issue when your document is opened in MS Word 2016. Please open the MS Word and click File->Account->About Word. ms word version.png (27.1 KB). This will show the MS Word’s version. Please share it for further testing.

Here it’s

image.png (11.1 KB)

I don’t know if it’s something related to me…but I’ve tried on different version of Office on different pc …got always the same behave

@advapi,

Thanks for sharing the detail. We are investigating this issue and will get back to you soon.

Is it possible to compare document with content control using “aspose. Words dll”.

@advapi,

Please note that Aspose.Words mimics the behavior of MS Word. If you open your HTML in MS Word, you will notice the same row height. Please check the attached screenshot of HTML. input.png (22.7 KB)

@shivendraraj,

Thanks for your inquiry.

Yes, you can compare the documents using Document.Compare method. Please refer to the following article.
How to Compare Two Word Documents

Excuse me , do you want me to share a remote desktop for further investigation?

@advapi,

Thanks for your inquiry. This is not Aspose.Words’ bug. It is MS Word’s expected behavior. If you open out.docx and output.html in MS Word, you will get the same output. You are using old version of MS Word 2016. Please check your MS Office version. MSO version.png (11.2 KB). Please upgrade it to view the table’s empty rows. The upgraded version of MS Word show the correct output at our end.

Please note that we only provide support via forum.

I’ve checked but it gaves me this

image.png (10.7 KB)

@advapi,

Please open your HTML and output DOCX in MS Word that is installed at your system. Both documents will have same output in MS Word for table’s rows.