We are really pleased you decided to accept our patch and try to improve validation - again, thanks so much!
We recently started having a new validation error in production for a particular bit of HTML. I have tried to come up with a fix myself, but it is taking me long enough to understand that I thought posting it here might be faster.
We are getting validation errors like this:
If the fix is immediately obvious to you, great. Otherwise let me know if you need more detail, such as the original HTML source - I can build a test case up for you.
We recently started having a new validation error in production for a particular bit of HTML. I have tried to come up with a fix myself, but it is taking me long enough to understand that I thought posting it here might be faster.
We are getting validation errors like this:
ID: Sch_AttributeValueDataTypeDetailed
Description: The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:val' has invalid value ''. The attribute value cannot be empty.
ErrorType: Schema
Node.OuterXml: <w:tblStyle w:val="" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" />
Path.XPath: /w:document[1]/w:body[1]/w:tbl[2]/w:tblPr[1]/w:tblStyle[1]
Part: /word/document.xml
It's because HtmlToOpenXML is trying to set a null "Val" parameter in a tblStyle element. This setting happens in a variety of places in the HtmlToOpenXML code; I haven't yet isolated which is causing us our particular problem, but here's a representative one from HtmlConverter.ProcessTag.cs Table currentTable = new Table(
new TableProperties {
TableStyle = new TableStyle() { Val = htmlStyles.GetStyle("Table Grid", StyleValues.Paragraph) },
TableWidth = new TableWidth() { Type = TableWidthUnitValues.Pct, Width = "5000" }, // 100% * 50
},
here htmlStyles.GetStyle is returning null, so the required attribute Val is null, and we fail validation.If the fix is immediately obvious to you, great. Otherwise let me know if you need more detail, such as the original HTML source - I can build a test case up for you.