我正在创建一个范围,给它一个值,然后像这样设置样式:
private string fontForSheets = "Calibri";
Range unitNameRange = locationWorksheet.Cells.CreateRange("A1", "D1");
unitNameRange.PutValue(_unit, false, true); // val, isConverted, SetStyle. Don't know if these bools are right...
CellsFactory cf = new CellsFactory();
Style style = cf.CreateStyle();
style.HorizontalAlignment = TextAlignmentType.Left;
style.Font.Name = fontForSheets;
style.Font.IsBold = true;
style.Font.Size = 14;
unitNameRange.SetStyle(style);
但风格并非“吸收” - 价值是一个简单,通用的文字;它是Arial 10,没有粗体。如何才能使风格符合范围?
是第二个还是第三个,或两个都错了?我猜测将isConverted设置为false并将SetStyle设置为true ...