Last Updated: 12 Dec 2018 09:21 by ADMIN
Created on: 07 Dec 2018 10:14
Category: SpreadStreamProcessing
Type: Bug Report
System.ArgumentException: ''', hexadecimal value 0x08, is an invalid character.'

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:

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 })));

1 comment
Posted on: 12 Dec 2018 09:21
Hello Dmytro,

We have logged a bug report and I added an additional vote for it on your behalf to increase its priority. You can subscribe to the public item if you would like to receive notifications about status changes on it. I declined this item as it is a duplicate of this: SpreadStreamProcessing: ArgumentException is thrown when exporting characters not supported in XML. You can use the workaround described in the item until the fix is ready. 

Hope this helps.

Progress Telerik
Get quickly and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.