I have a code block which converts HTML data to DOCX file using aspose. The entire html is being rendered in the doc. But it being truncated. Means the html design is not wrapping up inside a page properly.
Please find the attached files for better understanding my issue.
Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 17.4 and have not found the shared issue. Please use Aspose.Words for .NET 17.4. We have attached the output document with this post for your kind reference.
I have downloaded the attached docx file you have sent and opened with Microsoft Word 2007. Still the same problem. Additionally go to print preview and you will see that the contents are truncated. There is one more oddity noticed. If the file is opened with WPS office then it is rendering perfectly but in MS word the problem is occurring.
What we need is that the entire content of the table must wrap inside a A4 sheet. [Check the attached file.]
Please tell us what change is required in the code I have sent previously.
We have tested the scenario and have managed to reproduce the same issue at our side. MS Word 2016 displays the table correctly. Please check the attached image. However, MS Word 2007 displays the table incorrectly.
For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15181. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.
Thanks for your patience. It is to update you that we have closed the issue (WORDSNET-15181) with “Won’t Fix” resolution. Please use Table.AllowAutoFit property as shown below to get the desired output.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(File.ReadAllText(MyDir + "htmltoconvert.html"));
doc.FirstSection.Body.Tables[0].AllowAutoFit = false;
doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2007);
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.