我使用OpenXml SDK 2.0创建了一个Excel文档,现在我必须设置它的样式,但我不能.
我不知道如何绘制背景颜色或更改不同单元格中的字体大小.
我创建单元格的代码是:
private static Cell CreateTextCell(string header, string text, UInt32Value index)
{
Cell c = new Cell();
c.DataType = CellValues.InlineString;
c.CellReference = header + index;
InlineString inlineString = new InlineString();
DocumentFormat.OpenXml.Spreadsheet.Text t = new DocumentFormat.OpenXml.Spreadsheet.Text();
t.Text = text;
inlineString.AppendChild(t);
c.AppendChild(inlineString);
return c;
}
Run Code Online (Sandbox Code Playgroud)