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

Free Support Forum - aspose.com

Aspose.Cells background color

Dear Sir,

We are evaluating now Aspose.Cells trial (ver 4.8.0.0.) and already in
the process of procurement of Developer OEM Subscription license. Working on
solution which we have to deliver soon I discovered problem which I couldn’t
resolve. The source of the problem is that code shown below doesn’t work - cells
are not colored (always have white background). I tried even to use standard
colors (e.g. Color.Red) but it didn’t fix a problem. Also I tried to change
colors of cell border but again unsuccessfully. Maybe it happens because I used
Excel 2007 but processing files in previous versions.

I checked first my problem on Aspose forum but it didn’t
give me clear solution.

//Define Data Cell style

int dataStyleIndex =
workSheet.Workbook.Styles.Add();

Style dataStyle =
workSheet.Workbook.Styles[dataStyleIndex];

workSheet.Workbook.ChangePalette(Color.FromArgb(219, 229, 241), 55);
dataStyle.BackgroundColor = Color.FromArgb(219, 229, 241);
dataStyle.Pattern = BackgroundType.Solid;



workSheet.Cells[excelPos.rowIndex, excelPos.colIndex].Style = dataStyle;


With best
regards,

Vladimir Zemskov,
Technical Support Specialist
External Systems Unit
Information Technology
Service
Regional Office for Central Asia
United Nations Office on Drugs
and Crime

Tel: (+ 998 71) 120 80 50
Websites:
www.unov.org,
www.unodc.org

Impossible is not a
fact, only an opinion


This message was posted using Email2Forum by nausherwan.aslam.

Hi,

Thank you for considering Aspose.

If you need to specify the pattern as “BackgroundType.Solid”, you need to specify the Style.ForegroundColor as Style.BackgroundColor will not be applied in that case. Please see the following documentation link for more details,

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/colors-background-patterns.html

Thank You & Best Regards,