Free Support Forum - aspose.com

Legend Chart size cannot be automatic on only Height OR Width

Hi.

Another issue I encountered in my current project (ie OLE Excel Charts insertion in a Powerpoint presentation) is the following :

I wanted to set the Width of my Chart Legend to a constant, while not giving any value to its Height so that it should be automatic. This does not work : if only one of the 2 dimensions is set, the other is zero and not auto (as it is for both when none is set). Therefore, the Legend is not visible.

Please, see sample project included, with template and result presentation.

Thanks.

Yann BICREL

Infocube - France

Hi,

Thanks for providing us the project.

Well, I am afraid you do need to set both attributes (width + height) if you want to customize legend size. Otherwise the other attribute would be zero. For confirmation, even if you could save the excel file for the third chart, i.e…, adding a line to your code:

Book.Save(“ExcelFile.xls”)
ms = Book.SaveToStream()

you can see that the legend’s height of the chart is rendered with 0 size. So, if you want to customize the legend size, kindly set both attributes for your need.

And, we will further analyze if this could be done (possible) setting only one attribute b/w the two.

Thank you.

Thank you for considering my request.

Indeed it seems at the moment impossible to customize only one size of the legend.

However, it would really be useful if it could be done un the future.

Regards,

Yann BICREL

Infocube- France

Hi Yann,

We have logged your feature request into your issue tracking system with an issue id: CELLSNET-13549. We will keep you updated if there is any progress about it.


Thank you.

Hi,

<span style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(31, 73, 125);”>Please simply call Chart.Calculate() if you only want to set the
Height or width of the legend box.<o:p></o:p>


See following code:

Chart.IsLegendShown = True

Chart.NSeries(0).Name = "Legend 1"

Chart.NSeries(1).Name = "Legend 2"

'Chart.Legend.Height = 150

Chart.Calculate()

Chart.Legend.Width = 200



Thank you.