Reputation: 438
I am new in OpenXML using C#. I don't know how to set border style from the range of A1:M30. Using OpenXML in C#
Can any one please help me !!
Upvotes: 1
Views: 2725
Reputation: 325
For your specific problem I would loop through the cells in each row untill you have found the ones that need borders, then apply the formatting: (Note that DesiredCell is for you to add your cell reference checking)
foreach(Row row in sheetData.Elements<Row>)
{
foreach(Cell cell in row.Elements<Cell>)
{
if(cell.CellReference == DesiredCell)
{
cell = new Cell(new CellValue(“ ”)) { DataType = CellValues.String, StyleIndex = 1 };
}
}
}
You will also have to add the style index from the link above.
Upvotes: 2