We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Legend order rendered differently from Excel chart in session 0 vs. session 1


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).


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 for your query.

I have tried this scenario using Psexec.exe from the following link:

I followed all the steps you suggested and created two EMF files using exe file provided by you. I am afraid that no issue is observed and EMF files are created similar to the original EXCEL file legend. I have used Windows 7 64bit VM for my testing. Could you please share your environment details?


Thanks for your information.

I’m using windows 7 64bits. I do remember I had similar issues on my machine (different image in session 0 vs. session 1) Different StandardHeight/StandardWidth when run in Session 0 vs Session 1
And at that time only specific hardware configuration can cause such issue, and this time it is rather weird that the legend got swapped.

I also tried in some other machines/vm and could not reproduce the issue.

For your reference, I have made a recording of my steps (run the exe in my session 0 and session 1 with the output comparison). I cannot attach it due to the size limit, but the recording is available in


You may be able to view it online.

Is there any information that your engineering team can think of that could possibly impact the rendering result on different hardware configuration?



We were not able to observe the issue but we saw the issue in the video provided by you. We need to look into it more and have logged the issue in our database for investigation. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46454 - Legend order rendered differently from Excel chart in session 0 vs. session 1


Please try our latest version/fix: Aspose.Cells for .NET v18.11.6 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells18.11.6 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells18.11.6 For .Net4.0.Zip (4.7 MB)

The issues you have found earlier (filed as CELLSNET-46454) have been fixed in Aspose.Cells for .NET v18.12. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi