Hi,
I want to add Header and Footer text to the chart object.
I tried to look for a property in the Chart class, but could not find it.
Please let know if there are any property for this requirement.
If not, is there a work around for this.
Thanks and regards,
Vinay
Hi Vinay,
Please attach an Excel file which you can create manually with sample chart and header and footer here.
Hi,
Well, I think as a workaround, you may try to add label or text box to the chart (as header/footer) for your need. See the document for your reference:
Controls in Charts
Thank you.
Hi,
I am trying to add a textbox into the chart using the below code.
Aspose.Cells.Drawing.TextBox textbox0 = chart.Shapes.AddTextBoxInChart(footerY,footerX, footerHeight, footerWidth);
Within the textbox how can I align the text to appear either on left or right or center of the textbox frame.
Thanks,
Vinay
Hi,
I think you may try to use TextHorizontalAlignment, TextVerticalAlignment and other properties of Shape class for your need.
e.g
//…
textbox0.TextHorizontalAlignment = TextAlignmentType.Left;
textbox0.TextVerticalAlignment = TextAlignmentType.Top;
textbox0.TextOrientationType = TextOrientationType.TopToBottom;
Thank you.
Hi,
Thanks for the quick response.
Now I am trying to add a Textbox at the bottom of the chart.
In the chart image, the Textbox is completely hiding the category axis labels.
In the excel file, the Textbox is partially hiding the category axis labels.
Please see the attached output files.
Is there a way to adjust the Textbox, such that it does not hide the category axis labels.
Please find the attached code file and the output files:
Thanks and regards,
Vinay
Hi,
Thanks for providing us the project.
I have tested your project and found
the issue as the user has mentioned by your screen_shots. The image is
not the same as the source Excel chart.
I have logged an issue with an id: CELLSNET-24551. We will look into it soon.
Thank you.
Hi,
1 - Chart2Image works fine.
Chart2Image works as MS Excel because the workbook has been converted to xlsx file format in GenerateAndSaveChartImage method.
Please save the workbook as xlsx file, you will get the same result.
2 - If you do not want textbox cover the chart axis labels,
a) Please reduce the size of the plotsize: chart. PlotArea.Width -= 200;
b) Set textbox0.FillFormat.IsVisible = false; to the text box Transparent
Hi,
Thanks for the reply,
I am now setting the textbox0.FillFormat.IsVisible = false;
But if I alter the PlotArea, then the legend overlaps the plotarea region.
Please insert the below code in the InsertFooter() method.
//reduce the PlotArea.Height by 2%
int plotAreaHeight = chart.PlotArea.Height;
chart.PlotArea.Height -= (2 * plotAreaHeight) / 100;
Please inspect this scenario and let know what could be done:
Thanks and regards,
Vinay