linkedinfacebooktwittermenuarrow-up

GemBox Support Forum

Setting the background color for set of cells using html in gembox

i am trying the following code: it does not work, although i tested for HTML editor, it works perfectly.

 html = @"<div style='font:11pt Calibri'>
            <p style='background:#DDEBF7'> <span style='font-weight:bold'>Claim Prefix – As entered max three (3) alpha and/or numeric characters to have system-generated claim number assigned</span> <span>(i.e. 'CLM' will result in the next claim number being concatenated with claim id prefix….CLM000000001). Maximum length of claim number can be 18.</span></p>           
            </div>";

            worksheet.Cells["A6"].SetValue(html, htmlOptions);
            worksheet.Cells["A6"].Style.WrapText = true;
            worksheet.Cells["A6"].Style.HorizontalAlignment = HorizontalAlignmentStyle.Left;

However the following code works if there is no span tag:

 html = @"<div style='font:11pt Calibri'>
            <p style='font-weight:bold;background:rgb(217,217,217)'>Claim ID - As entered max fifteen (15) alpha and/or numeric characters for generating the claim number. If claim prefix is blank and Claim ID is entered then system will take claim prefix as defined on account level. If claim prefix is not defined on account level then claim no can't be generated.</p>
            
            </div>";

            worksheet.Cells["A8"].SetValue(html, htmlOptions);
            worksheet.Cells["A8"].Style.WrapText = true;
            worksheet.Cells["A8"].Style.HorizontalAlignment = HorizontalAlignmentStyle.Left;

Can anyone help in this, how should i get background color for set of cells. Attached is the sample excel sheet image.

Hi Akash,

Please try again with this bugfix:
https://www.gemboxsoftware.com/spreadsheet/nightlybuilds/GBS49v1122.zip

Or this NuGet package:
Install-Package GemBox.Spreadsheet -Version 49.0.1122-hotfix

Does this solve your issue?

Regards,
Mario