Hi Team,
I am trying to set the chart title’s horizontal alignment as RIGHT. But horizontal alignment is always coming as CENTER. Please find below the code which I am using.
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);
Cells cells = sheet.getCells();
cells.get(0, 1).putValue("Income");
cells.get(1, 0).putValue("Company A");
cells.get(2, 0).putValue("Company B");
cells.get(3, 0).putValue("Company C");
cells.get(1, 1).putValue(10000);
cells.get(2, 1).putValue(20000);
cells.get(3, 1).putValue(30000);
int chartIndex = sheet.getCharts().add(com.aspose.cells.ChartType.COLUMN, 2, 2, 31, 21);
Chart chart = sheet.getCharts().get(chartIndex);
chart.getNSeries().add("B2:B4", true);
chart.getNSeries().setCategoryData("A2:A4");
Series aSeries = chart.getNSeries().get(0);
aSeries.setName("=B1");
chart.setShowLegend(true);
chart.getTitle().setText("Income Analysis");
chart.getTitle().setTextHorizontalAlignment(com.aspose.cells.TextAlignmentType.RIGHT );
workbook.save("C:\\chartTitle.xlsx");
Attached the output excel. chartTitle.zip (8.4 KB)
Could you please let me know if I am doing anything wrong or guide me how to set chartTitle alignment
Thanks,
Thilak