Hello,
We are evaluating npoi for reading the content of Excel Sheets. One of our backlog items is that the editors of the excel sheets use custom styles in order to mark certain cells. From npoi we would like to retrieve the names of these styles.
We have already figured out that the styles are saved within the xlsx archive in a certain xml file and that we can access that content in poi from the workbook.
NPOI.OpenXmlFormats.Spreadsheet.CT_CellStyles cellStyles =
{
The name is exactly the part that we want to access from a cell.
On the cell we tried to match cell.CellStyle.Index with the xfid field. Unfortunately, that does not work since we do not get the correct styles.
Our question is therefore how to get the correct CT_CellStyle from any given cell object.
Thanks in advance
Markus
We are evaluating npoi for reading the content of Excel Sheets. One of our backlog items is that the editors of the excel sheets use custom styles in order to mark certain cells. From npoi we would like to retrieve the names of these styles.
We have already figured out that the styles are saved within the xlsx archive in a certain xml file and that we can access that content in poi from the workbook.
NPOI.OpenXmlFormats.Spreadsheet.CT_CellStyles cellStyles =
((NPOI.XSSF.UserModel.XSSFWorkbook)cell.Sheet.Workbook).GetStylesSource().GetCTStylesheet().cellStyles;
for (int i = 0; i < cellStyles.count; i++){
NPOI.OpenXmlFormats.Spreadsheet.CT_CellStyle cellStyle = cellStyles.cellStyle[i];
string name = cellStyle.name;
}The name is exactly the part that we want to access from a cell.
On the cell we tried to match cell.CellStyle.Index with the xfid field. Unfortunately, that does not work since we do not get the correct styles.
Our question is therefore how to get the correct CT_CellStyle from any given cell object.
Thanks in advance
Markus