We are using the below code to fill color to shapes/textBoxes in excel
for (int shapeIndex = 0; shapeIndex < workbook.Worksheets[sheetId].Shapes.Count; shapeIndex++)
{
var shape = workbook.Worksheets[1].Shapes[shapeIndex];
// Apply black color fill for the first redaction
if (shape.Fill.SolidFill != null) shape.Fill.SolidFill.Color = System.Drawing.Color.Black;
if (shape.Line.SolidFill != null) shape.Line.SolidFill.Color = Color.Red;
shape.Line.Weight = 1;
shape.Font.Color = System.Drawing.Color.White;
shape.TextHorizontalAlignment = TextAlignmentType.Center;
shape.TextVerticalAlignment = TextAlignmentType.Center;
shape.Text = “reason”;
}
In case of textBox with noFill, we observed that the solidFill is coming as null and we are not allowed to fill with other color like “black”, please suggest ways or see if this is an issue.
Please find attached the excel containing the textBox like mentioned
noFill_textBox issue.zip (243.2 KB)
In the attached excel, you can find the textBox in second row having textBox text as “hello everyone”