Declined
Last Updated: 12 Dec 2018 09:21 by ADMIN

ArgumentException with clarification similar to "'\u001f', hexadecimal value 0x1F, is an invalid character." is thrown when trying to export document containing characters which are not supported in XML document - such as some control characters like 0x00, 0x1F, 0x1B, etc.

Such characters are described in the XML specification here: https://www.w3.org/TR/xml/#charsets.


Code to reproduce 
using (var stream = File.OpenWrite("sample.xlsx"))
using (var workbook = SpreadExporter.CreateWorkbookExporter(SpreadDocumentFormat.Xlsx, stream))
using (var worksheet = workbook.CreateWorksheetExporter("My sheet"))
using (var row = worksheet.CreateRowExporter())
using (var cell = row.CreateCellExporter())
{
      cell.SetValue(string.Format("Error Value: {0} ", Encoding.ASCII.GetString(new byte[] { 8 })));
}