To make cell bold of an excel using Excel.OpenXml.Table .
The code :
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);
I want to make c1 cell bold .What i have tried :
Cell<string> c1 = new Cell<string>("Row number " + i.toString(),10);
ANd
c1.BoldIndex =10 ;
But no effect . c1. style is not there .any help will be appreciated
To add a cell value,
Add the string content to the SharedStringTable, and use the index of that item as
cellvalue.text = index
To make a cell bold:
StyleIndex = (UInt32Value)1U
You can add it to:
Cell cell1 = new Cell(){ CellReference = "A1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.