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

Free Support Forum - aspose.com

Chart Legend Placement

I use an existing Excel 2003 file as a template for a scatter chart (attached). The scatter chart has the background, titles, and legend laid out as I want them. AFter loading the template, importing the dataview and creating the series (which all work nicely) the legend box gets re-formatted or moved.

If I use the the statement:

m_oChart.Legend.Position = LegendPositionType.Bottom;

OK, continued. (not sure how the previous posted)

then the legend box gets resized. If I don't use that statement then the legend box stays the same size but changes location to the left as if left justifed on the left margin.

Can this be corrected to leave the legend in the same spot? This does not happen in Excel.

I also don't see an option to attach my file in this reply ... Can I email it to you?


Thanks for the details.

Could you post your template file with sample code here. For attaching files, you 'd better zip them first to make it one. When you click Reply button to reply this post, you may see Add/Update button for file attachment at the bottom above the Post button.

Which version you are using? By the way could you give a try with the attached version.

Thank you.

I think I was doing a quick reply before so I could not upload a file. Attached is the template file. The code that populates the worksheet with data then creates the chart is quite extensive and tied to a dataset and its tables. If you look at the chart sheet and the see how the legend is formatted on the page maybe you can see what I mean.

When the workbook is saved the legend border changes or moves. I need it to stay put.


By the way, I tried the version you provided ( and it didn't help. In fact I had to roll back to version because the colors for conditional formatting were no longer showing.


Thanks for the template file,

We will figure out your issue soon.

Thanks for being patient!


Please try this fix.

Could you post a simple project with the template file to show the error of conditional formatting. We will check it soon.

I'm conversing with Amjad Sahi in post number 108966 regarding the conditional formatting since he had sent me a copy of release version regarding a number formatting problem I am having.

I've attached two files. One file was created using Excel Macros. The other with Aspose Cells using version which you provided. The legend box now stays centered which is good. But please notice how Aspose Cells resizes the legend box.

Thank you for all your help.

Sorry, Attached is a zip file that contains both examples.


Thanks for the template files, we will figure it out soon.

Thank you.


Please try this fix.

We have fixed the bug of conditional formattings.

Could you post your sample codes and template file to show how to create such a chart? We find the legend is not auto size. We do not re-size the legend if the content is changed.