I am trying to push information to a excel file while preserving the cell format. That is there is already a style in the cell before I push data to it and I want it to have the same style after I push data to it. The following code is part of one
of my classes. I don’t know if I am making a mistake or if there is a bug in the simple OOXML library. Any response would be greatly appreciated.
worksheetName, string columnName,
WorksheetPart worksheetPart =
SpreadsheetStyle spreadsheetStyle =
WorksheetReader.GetStyle(spreadsheetDocument, worksheetPart, columnName, rowNumber);
WorksheetWriter.PasteText(spreadsheetDocument, worksheetPart, columnName, rowNumber, cellValue.ToString());
WorksheetWriter.SetStyle(spreadsheetStyle, spreadsheetDocument, worksheetPart, columnName, rowNumber);
Let me elaborate a little bit. The
WorksheetReader.GetStyle function always returns null for its
FormatCode. So I can never perserve the format code.