Hi,
I’m trying to convert an Excel worksheet to image and try to mimic the ‘Separators’ feature in Excel application settings:
image.png (35.0 KB)
However, I found Aspose threw an exception after I changed the code using Aspose APIs.
Code:
var doc = new Workbook(@"\test.xlsx"); var options = new ImageOrPrintOptions { ImageType = ImageType.Emf, OnlyArea = false, // copy as picture - as shown when printed TextRenderingHint = TextRenderingHint.ClearTypeGridFit, OnePagePerSheet = true, Transparent = true }; doc.Worksheets[0].PageSetup.PrintArea = "B7:G20"; doc.Settings.NumberDecimalSeparator = ','; doc.Settings.NumberGroupSeparator = ' '; // the possible problematic line new SheetRender(doc.Worksheets[0], options).ToImage(0, @".\out.emf");
It threw an exception on the last line.
Aspose.Cells.CellsException: Non-negative number required.
Parameter name: length
I’ve attached my test files for your reference. Could you please help me take a look?
test.zip (11.1 KB)
Thanks,