1

Closed

Order of tblGrid and tblPr wrong

description

When making a table, you get a validation error in "Open XML SDK 2.0 Productivity Tool for Microsoft" since tblGrid is followed by the tblPr properties. The specification says, that the properties have to come first, and being followed by the grid:
 
http://msdn.microsoft.com/en-us/library/dd633612(v=office.12).aspx :
"When you run the code, you get another validation error that tells you that you must first add the TableGrid (tblGrid) after the TableProperties, so you modify the code as follows."
 
The code in HtmlConverter.ProcessTag.cs on line 1105 has to be changed from:
 
tables.CurrentTable.PrependChild<TableGrid>(grid);
 
To:
 
tables.CurrentTable.InsertAt<TableGrid>(grid, 1);
 
(assuming that at the first position of a table there always are tblPr elements, at least specifiying the width of the table. Is that correct?).
 
After patching the code like above, a document with tables validates well.
 
Regards
Gregor Favre
Closed Aug 3, 2012 at 9:31 AM by onizet
Fix in changeset #61690

comments

cosh wrote Apr 11, 2012 at 12:09 PM

Seems as this is now closed in the latest downloadable source. Thanks!