HTML Tables >15 inches are forced to 15 inches during DOCX generation

Converting an HTML document with tables greater than 15 inches in width to a DOCX forces the tables to 15 inches. I’m using Aspose.Words for .NET version 22.1.0.

To do the conversion, I’m loading the html document, setting a page size for easier viewing, and saving as a docx:
Document docTest = new Document(“LargeTables.html”);
DocumentBuilder builder = new DocumentBuilder(docTest);
builder.PageSetup.PaperSize = PaperSize.Custom;
builder.PageSetup.PageWidth = ConvertUtil.InchToPoint(10);
builder.PageSetup.PageHeight = ConvertUtil.InchToPoint(20);
builder.PageSetup.Orientation = Orientation.Landscape;
docTest.Save(“LargeTables.docx”);

The page size changes are not needed to reproduce the issue. I have attached a zip which contains an input LageTables.html and the current output I’m getting LargeTables.docx:
LargeTables.zip (7.2 KB)

@bmentzer This is an expected behavior. MS Word allows table’s width to be manually set max to 22 inches but when importing from HTML it allows max 15 inches. Aspose.Words mimics this MS Word behavior.

Is there a way to work around this or fix it after import? Having the tables generate incorrectly is very blocking for us.

@bmentzer You can set the width of the table after loading document into Aspose.Words Document. For example see the following code:

Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
table.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.InchToPoint(22));

Note, 22 inches is the maximum allowed width.

Is there a way to get the original size of the table? Tables importing will have various sizes and I need to know what the original width was to set them after loading the document. It seems that table.PrefferedWidth is 15in in all my cases. Is there another property that would have the originally set sizes?

@bmentzer Unfortunately, there is no field where the original width value from HTML is stored. The only way is parsing the original HTML and take the value from there.