I’m in the end of evaluating the Aspose.Word component and I’m very satisfied.
I have one problem left thought,
I need to set the background colour of cells the same colour as this paragraph in the cell, and is using the code below:
private void WriteCell( DocumentBuilder dBui, int num, string text, string format, ParagraphAlignment alignment, bool addTypeName, int typeID ) { dBui.InsertCell(); dBui.RowFormat.HeadingFormat = false; dBui.CellFormat.Width = this.cellwidths[num]; dBui.ParagraphFormat.StyleName = format; dBui.CellFormat.Shading.BackgroundPatternColor = dBui.ParagraphFormat.Shading.BackgroundPatternColor; dBui.ParagraphFormat.Alignment = alignment; dBui.Write( text ); } |
Now, when opening in Word it says that the table is corrupt and I need to convert the table to text.
Remove the line
dBui.CellFormat.Shading.BackgroundPatternColor = dBui.ParagraphFormat.Shading.BackgroundPatternColor; |
and the result is error free.
What am I doing wrong??
Thanks for a really useful piece of code
/Staffan