Hi!
I’m converting xlsx files to html using Aspose.Cells 20.7.0. I have a requirement to support special unicode characters inside the cells. When running the following code, with the archive attached below, I get an exception: “System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+”.
charts.zip (13.4 KB)
var input = @"...\charts.xlsx";
var output = @"...";
AsposeLicenser.LoadLicense();
var specialCharacter = '\x200D'; //zero-width joiner
// the exception does not come for other zero-width characters, e.g. \x200C
var sequence = new string(specialCharacter, 200);
// if this would have length 100, the exception would not come
using (var wb = new Workbook(input))
{
var cell = wb.Worksheets[0].Cells[0, 1];
Assert.AreEqual("ValueX", cell.Value);
cell.Value = sequence + "test" + sequence;
wb.Save(output, new HtmlSaveOptions
{
ExportImagesAsBase64 = true
// if this would be false, the exception would not come
});
}
As explained by the comments, I only get the exception in specific cases.
As a workaround, I tried using it with “ExportImagesAsBase64” set to false, while doing the image inlining myself. However, “test” does not show up on the chart legend of the first chart and the second chart goes missing if the length of the sequence is longer than a certain limit:
var input = @"...\charts.xlsx";
var output = @"...";
AsposeLicenser.LoadLicense();
var specialCharacter = '\x200D'; //zero-width joiner
var sequence = new string(specialCharacter, 300);
// works fine if the length is 100 instead of 300
// if length is 200, "test" shows up on the first chart, but the second still chart goes missing
using (var wb = new Workbook(input))
{
var cell = wb.Worksheets[0].Cells[0, 1];
Assert.AreEqual("ValueX", cell.Value);
cell.Value = sequence + "test" + sequence;
wb.Save(output, new HtmlSaveOptions { ExportImagesAsBase64 = false });
}
I know my use case is pretty specific, but in both cases the differences in behaviour induced by small changes are unexpected.
Thanks for any help!
Arnold