We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Set Shading Fill & Patterns for Table in Word Document (C# .NET) | Table Background Fill

Hi,

I’m struggling to apply expected formatting to my table, using Aspose.Words 21.5.0. Could you please advise?

I’m using the following code:

var doc = new Aspose.Words.Document();
var builder = new DocumentBuilder(doc);
var table = builder.StartTable();
builder.InsertCell();
builder.InsertCell();
builder.EndRow();
builder.InsertCell();
builder.InsertCell();
table.CellSpacing = 8;
table.SetShading(TextureIndex.TextureNone, Color.Red, Color.Red);

In the resulting document (Output.docx) the colour is applied only to the cells and not to the space between them.
In MS Word, when I set shading, both the cells and the space between them get the colour (Expected.docx).
Is there any way to mimic Word’s behaviour?

Thanks,
Michał

Expected.docx (11.5 KB)
Output.docx (7.2 KB)

@acturisaspose,

We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-22302. We will further look into the details of this problem and will keep you updated here on the status. We apologize for any inconvenience.

The issues you have found earlier (filed as WORDSNET-22302) have been fixed in this Aspose.Words for .NET 21.10 update also available on NuGet.