Free Support Forum -

Table Call background

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.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

Hi Staffan,

Thank you for considering Aspose.

Your code works for me, no corrupted table in the output. I’m using MS Word 2003 SP1 to view it.

Please make sure you are using the most recent Aspose.Word version. Also, post all the code you use for building the table.

Thanks Dimitry
Using the moste recent version solved the problem. I was using ver. 2.XX.

You will get an order for the component ASAP.