Table width not adding up correctly


#1

Hi to the Aspose.Words team

I am adding a table dynamically using:
builder.MoveToMergeField(“PRS_TableStart”)
builder.StartTable()
builder.Font.Underline = Underline.Single
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center
builder.InsertCell()
builder.CellFormat.Width = 69
builder.CellFormat.Borders.LineStyle = LineStyle.Hairline
builder.Write(“Consent No.”)
builder.InsertCell()
builder.CellFormat.Width = 92
builder.Write(“Date of Decisions”)
builder.InsertCell()
builder.CellFormat.Width = 113
builder.Write(“Statutory Authority”)
builder.InsertCell()
builder.CellFormat.Width = 149
builder.Write(“Description”)
builder.InsertCell()
builder.CellFormat.Width = 71
builder.Write(“Status”)
builder.Font.Underline = Underline.None
builder.EndRow()
For i = 0 To 8
builder.InsertCell()
builder.CellFormat.Width = 69
builder.InsertCell()
builder.CellFormat.Width = 92
builder.InsertCell()
builder.CellFormat.Width = 113
builder.InsertCell()
builder.CellFormat.Width = 149
builder.InsertCell()
builder.CellFormat.Width = 71
builder.EndRow()
Next
builder.EndTable()
This was hoped to result in a table that was 17.44cm wide in total (494points). However the table that results has columns that have the correct ‘preferred widths’. However the ‘Preferred Width’ of the table is 12.75cm.
Is there a way that when I StartTable that I can set the ‘Preferred Width’?

Currently using Version 3.5.1.0 of Aspose.Words

Thanks and best regards

Ralph Price (GIS_Analyst)
Rotorua District Council


#2

For a more complete problem description I have attached a zip file containing an .aspx, .aspx.vb, template.doc and a result.doc

Regards
Ralph Price (GIS_Analyst)
Rotorua District Council


#3

Hi Ralph,

Thank you very much for your request. Testing shows both the tables (built and original) have the same cell widths and preferred widths but different table preferred widths as you noticed (the term "table preferred width" actually means "preferred width of the rows forming the table" because the .doc binary format actually stores tables as sets of independent rows). Anyway, these values are different for the tables and this causes the improper output.

I should discuss with Roman some problems that might arise if PreferredWidth gets exposed. Your request has been logged as issue #909.


#4

We will improve and extend public API for the tables in the future. Sorry no timeline for this, but it’s high on the list of tasks.