簡體   English   中英

使用Excel.OpenXml.Table使Excel的單元格加粗

[英]To make cell bold of an excel using Excel.OpenXml.Table

使用Excel.OpenXml.Table使Excel的單元格加粗。

編碼 :

 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。 風格不在那里。任何幫助將不勝感激

要添加單元格值,

將字符串內容添加到SharedStringTable,然后將該項目的索引用作

cellvalue.text = index

使單元格加粗:

StyleIndex = (UInt32Value)1U

您可以將其添加到:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM