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

Free Support Forum - aspose.com

Bug report - Table.BackgroundColor (VB.NET)

Hi !

Hope it won’t be just a bug already reported, but I find that when I apply a backgroundcolor on a Table object and on a cell of this table, there is some kind of color mix.

Here’s the code I used :
Dim license As License = New License
license.SetLicense(“Aspose.Total.lic”)

Dim pdf1 As Pdf = New Pdf()
Dim Section As New Section
Section.PageInfo.PageWidth = PageSize.A4Width
Section.PageInfo.PageHeight = PageSize.A4Height
Section.PageInfo.Margin = New MarginInfo
Section.PageInfo.Margin.Top = 0 : Section.PageInfo.Margin.Bottom = 0 : Section.PageInfo.Margin.Left = 0 : Section.PageInfo.Margin.Right = 0
Section = pdf1.Sections.Add()
Dim tableau As New Table
Dim myRow As Row = tableau.Rows.Add()
Dim cellule As Cell = myRow.Cells.Add(“bien”)
cellule.BackgroundColor = New Color(0, 0, 0)
tableau.BackgroundColor = New Color(200, 200, 200)
Section.Paragraphs.Add(tableau)
pdf1.Save(“D:\Test.pdf”)

Hello Anouck,

Thanks for using our products.

We are looking into the details of this problem and will get back to you soon. We apologize for your inconvenience.

Hello Anouck,

Thanks for your patience.

After further investigation, we have found that if you reorder the sequence of following code lines

cellule.BackgroundColor = New Color(0, 0, 0)
tableau.BackgroundColor = New Color(200, 200, 200)

to

tableau.BackgroundColor = New Color(200, 200, 200)
cellule.BackgroundColor = New Color(0, 0, 0)

the background color information is properly being applied. I have tested the scenario in which I have added 3 more cells in the same table row and have specified different background color information for two of the table cells and as per my observations, proper color information is being applied. Please take a look over the attached PDF document which is generated using following code

[VB.NET]

tableau.BackgroundColor = new Aspose.Pdf.Color(200, 200, 200)
cellule.BackgroundColor = new Aspose.Pdf.Color(0, 0, 0)

Dim cellule2 As Aspose.Pdf.Cell = myRow.Cells.Add("bien")
Dim cellule3 As Aspose.Pdf.Cell = myRow.Cells.Add("bien")
Dim cellule4 As Aspose.Pdf.Cell = myRow.Cells.Add("bien")
cellule4.BackgroundColor = new Aspose.Pdf.Color("Maroon")

In case it does not resolve your problem or you have any other query, please feel free to contact. We apologize for your inconvenience.