Free Support Forum - aspose.com

Table Cell Issue When Exporting to Word with 10.1

Hello,

We are exporting HTML content with tables to Word. And we are getting an issue where colspan is not being respected. In a table cell where is spans 2 columns. Instead of merging the cell it puts the content into 2 cells, where one of the cells is full width and the other is one pixel wide but very tall.

I have upload a example of what it looks like. Here is the HTML

<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-CA</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Cobit Control

Rationale

PO10 - Manage Projects

A project may identify a post implementation review needs to achieve the goals and objectives of the project.

AI3 – Acquire and Maintain Technology Infrastructure

The Technology Infrastructure Acquisition and Maintenance strategy and plan may identify post implementation review.

AI5 – Procure IT Resources

The acquisition of IT-related infrastructure, facilities, hardware, software, and services may initiate a post implementation review procedure.

AI6 – Manage Changes

While processing a change request, testing and acceptance procedure will be initiated to test the quality of change.

Note: As controls are developed as part of the ITM Control Framework, this list may be updated.

Thanks

Hi

Thanks for your request. I tried converting your HTML to DOCX using the latest version of Aspose.Words and output DOCX looks fine on my side.

Anyways, you can try using code like the following to remove a one-pixel column:

Document doc = new Document(@"Test001\test.html");

// Remove merged cells.

Node[] cells = doc.GetChildNodes(NodeType.Cell, true).ToArray();

foreach (Cell cell in cells)

{

if(cell.CellFormat.HorizontalMerge == CellMerge.Previous)

{

// get previouse cell.

Cell prevCell = (Cell)cell.PreviousSibling;

prevCell.CellFormat.Width += cell.CellFormat.Width;

cell.Remove();

}

}

// Save output.

doc.Save(@"Test001\out.doc");

Hope this helps.

Best regards,