I am editing an existing excel spreadsheet with an existing cell Style in it called "myFavouriteStyle".
Using OpenXML SDK V2 c# how do I find the StyleIndex of that style so I can apply it to new cell(s) I add to the spreadsheet.
Thanks.
I am editing an existing excel spreadsheet with an existing cell Style in it called "myFavouriteStyle".
Using OpenXML SDK V2 c# how do I find the StyleIndex of that style so I can apply it to new cell(s) I add to the spreadsheet.
Thanks.
If you can get a reference to a Cell with the "myFavouriteStyle" applied to it you could:
public static int GetCellStyleIndex(Cell theCell)
{
int cellStyleIndex;
if (theCell.StyleIndex == null)
{
cellStyleIndex = 0;
}
else
{
cellStyleIndex = (int)theCell.StyleIndex.Value;
}
return cellStyleIndex;
}