Free Support Forum - aspose.com

Workbook Cell Background-Color Formatting using Aspose.Cells for .NET in C#

Hello,
I’ve Aspose.Cells 7.0.2.0.
I’ve a question about formating Background-color cell with HTML.
I Set HtmlString Property with some attributes

excelSheet.Cells(0, 0).HtmlString = “<Font Style=”“FONT-WEIGHT: bold;FONT-FAMILY: Arial;FONT-SIZE: 12pt;COLOR: #ff0000;Background-Color:yellow;”">myValue"

After applying this style, Cell’s background-color isn’t yellow.
Why?
I don’t want Set Cell’s Style throught SetStyle() Method.

How Can I Solve?

Thanks!

Hi,


Thanks for providing details.

I am afraid, you have to use the Cell.GetStyle/SetStyle method (approach) to apply cell’s shading color as it looks Cell.HtmlString does not support to get/set cell’s background color. Anyways, I have logged a ticket with an id “CELLSNET-43218” for your issue. We will investigate and look into it if we could support it or not.

Once we have any update on it, we will let you know here.

Thank you.

Hi,

Thanks for using Aspose.Cells.

Please download and try the latest version: Aspose.Cells for .NET (Latest Version) and let us know your feedback.

The latest version works fine now and you can set the cell background using html string. Please see the following sample code and its output which I have attached with this post for your reference.

C#


Workbook workbook = new Workbook();


Worksheet worksheet = workbook.Worksheets[0];


Cell cell = worksheet.Cells[“E4”];

cell.HtmlString = “<Font Style=“FONT-WEIGHT: bold;FONT-FAMILY: Arial;FONT-SIZE: 12pt;COLOR: #ff0000;Background-Color:yellow;”>myValue”;


workbook.Save(“output.xlsx”);

The issues you have found earlier (filed as CELLSNET-43218) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Shakeel Faiz,


We are unable to download the version Aspose.Cells for .NET 8.3.1. So please send the that version dll through attachement.

Note: We tried to download by clicking showmore options, But its not working. Can you send to the Download link?

Thanks
Rengarajan N.
Hi,

Thanks for your posting and using Aspose.Cells.

If you need entire MSI or Zip Archive of Aspose.Cells, then please visit this download section.

Aspose.Cells Downloads Section