小编JAi*_*iro的帖子

使用OpenXml sdk 2.0创建Excel文档

我使用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)

c# excel openxml spreadsheetml

16
推荐指数
2
解决办法
4万
查看次数

标签 统计

c# ×1

excel ×1

openxml ×1

spreadsheetml ×1