Hi,
When rendering an Excel chart to an image. I found it very weird that if I render the chart in session 1 (Windows user session), the legend order is different from the chart rendered in session 0 (Windows system session).
Code:
CellsHelper.DPI = 96;
var workbook = new Workbook(@".\legend order.xlsx");
var options = new ImageOrPrintOptions
{
ImageType = ImageType.Emf,
OnlyArea = false,
TextRenderingHint = TextRenderingHint.ClearTypeGridFit,
OnePagePerSheet = true,
Transparent = true
};
workbook.Worksheets["sheet1"].Charts[0].ToImage(@".\legend order.emf", options);
For your convenience, I’ve attached the executable for your reference. Or you can build your own exe from the above code if you prefer, just make sure that the executable, Aspose.Cells.dll and the xlsx file needs to be under the same folder.
To render the chart in session 1: just double click the TestAspose.exe and it will render the “legend order.xlsx” to an image.
To render the chart in session 0: you will need to run cmd.exe under admin, then run command
psexec.exe -s -i 0 cmd.exe
to enter the interactive session 0 mode, then run the TestAspose.exe using the command line, the output will be produced.
I’ve also attached the test files, screenshot and output for your reference. Could you please help me check that? This starts concerning because the behaviour seems to be inconsistent using the same code.
Aspose.Cells.zip (4.5 MB)
image.png (57.8 KB)
Thanks,