Hi,
i upgraded to the last version.
Now i open a document with an still existing table
with an unknown structure.
I try to find out if a cell in a row is merged
horizontally or vertically or not.
Unfortunately the HorizontalMerge in CellFormat is always none.
Is there another way to get the information ?
Regards,
Guido
Hi Guido,
// Create empty document and DocumentBuilder object.<o:p></o:p>
Document doc = new Document();<o:p></o:p>
DocumentBuilder builder = new DocumentBuilder(doc);<o:p></o:p>
// Configure DocumentBuilder<o:p></o:p>
builder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);<o:p></o:p>
builder.getCellFormat().getBorders().setColor(Color.BLACK);<o:p></o:p>
// Build table, with simply wide cells.<o:p></o:p>
// First row will contains simply wide cell and in MS Word it will look like merged.<o:p></o:p>
builder.insertCell();<o:p></o:p>
builder.getCellFormat().setWidth(200);<o:p></o:p>
builder.write(“This is simply wide cell”);<o:p></o:p>
builder.endRow();<o:p></o:p>
// Insert the second row<o:p></o:p>
builder.insertCell();<o:p></o:p>
builder.getCellFormat().setWidth(100);<o:p></o:p>
builder.insertCell();<o:p></o:p>
builder.getCellFormat().setWidth(100);<o:p></o:p>
builder.endRow();<o:p></o:p>
builder.endTable();<o:p></o:p>
// Insert few paragraphs between table.<o:p></o:p>
builder.writeln();<o:p></o:p>
builder.writeln();<o:p></o:p>
// Build table, with merged cells.<o:p></o:p>
// First row will contains merged cells.<o:p></o:p>
builder.insertCell();<o:p></o:p>
builder.getCellFormat().setWidth(100);<o:p></o:p>
builder.getCellFormat().setHorizontalMerge(CellMerge.FIRST);<o:p></o:p>
builder.write(“This is merged cells”);<o:p></o:p>
builder.insertCell();<o:p></o:p>
builder.getCellFormat().setWidth(100);<o:p></o:p>
builder.getCellFormat().setHorizontalMerge(CellMerge.PREVIOUS);<o:p></o:p>
builder.endRow();<o:p></o:p>
// Insert the second row<o:p></o:p>
builder.insertCell();<o:p></o:p>
builder.getCellFormat().setWidth(100);<o:p></o:p>
builder.getCellFormat().setHorizontalMerge(CellMerge.NONE);<o:p></o:p>
builder.insertCell();<o:p></o:p>
builder.getCellFormat().setWidth(100);<o:p></o:p>
builder.getCellFormat().setHorizontalMerge(CellMerge.NONE);<o:p></o:p>
builder.endRow();<o:p></o:p>
builder.endTable();<o:p></o:p>
// Save output document<o:p></o:p>
doc.save(“C:\Temp\out.doc”);<o:p></o:p>
<o:p> </o:p>
The issues you have found earlier (filed as WORDSNET-6652) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.