2017-02-09 53 views
0

使用Excel.OpenXml.Table创建Excel单元格的粗体。使用Excel创建Excel的单元格粗体.OpenXml.Table

代码:

XLTable objXLTable = new XLTable("TEST"); 

Row<string> objDataRow = new Row<string>(RowType.Data); 



for(int i=0; i< 10 ; i++) 
{ 
     Cell<string> c1 = new Cell<string>("Row number " + i.toString()); 
     Cell<string> c2 = new Cell<string>("tt"); 
     Cell<string> c3 = new Cell<string>("bb "); 

     objDataRow.Add(c1); 
     objDataRow.Add(c2); 
     objDataRow.Add(c3); 
} 

objXLTable.Add(objDataRow); 

我要让C1单元格大胆的。什么我曾尝试:

Cell<string> c1 = new Cell<string>("Row number " + i.toString(),10); 

c1.BoldIndex =10 ; 

但没有效果。 C1。风格是不是有.ANY帮助将不胜感激

回答

0

要添加一个单元格的值,

字符串的内容添加到SharedStringTable,并使用该项目的索引

cellvalue.text = index

要使细胞大胆:

StyleIndex = (UInt32Value)1U

您可以将它添加到:

Cell cell1 = new Cell(){ CellReference = "A1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString }; 
相关问题