When a cell value contains commas or new lines, they are not escaped on export to CSV and single value is exported as multiple values. Workaround: Escape the value manually. For example, use the following extension method to set string cell values: internal static class CellExporterExtensions { public static void SetValue(this ICellExporter cell, string value, SpreadDocumentFormat format) { if (format == SpreadDocumentFormat.Csv) { if (value.Contains(",")) { // escape all quotes with double quotes value = value.Replace("\"", "\"\""); } // enclose all values within quotes value = string.Format("\"{0}\"", value); } cell.SetValue(value); } } Available in LIB version: 2017.1.403
Orientation, margins, scale to fit one page, paper type, header/footer, etc.
Add support for creating Tables and applying tables styles (predefined ones, similar to MS Excel, or custom).
Add support for Data Validation.
Add support for Comments.
If you want to export a document with modified Normal style, you have to modify it and then set it to at least one cell in order to be exported. This maybe is caused by the fact that if the style is not used it is not exported. Workaround: Export single cell in the row with this style applied to it: using (ICellExporter cell = row.CreateCellExporter()) { cell.SetFormat(new SpreadCellFormat() { CellStyle = normalStyle }); }
When exporting double values no value type is set to the cell. When a string value is exported the cell value type is set to Text. After setting string value the valueType is set to Text and when setting again value to double the type remains the same. When exporting double values no value type is set to the cell. When a string value is exported the cell value type is set to Text. After setting string value the valueType is set to Text and when setting again value to double the type remains the same. Workaround: Just set the value once and do not change it.