setTickLabelSpacing() not working for XLS version

Hi,

we’re happy with the aspose product and we are grateful for all the help that gave us through all the problems that we have.
we tried to fix the space between the tick-label using the function setTickLabelSpacing() .it worked but only for the xlsx format (2007 or higher) and it has no effect on the XLS format, the option “interval between label” never changed it’s always on “automatic”.

below a simple example of bar chart where you can see the difference.

//Instantiating a Workbook object

Workbook workbook = new Workbook();

//Obtaining the reference of the first worksheet

WorksheetCollection worksheets = workbook.getWorksheets();

Worksheet sheet = worksheets.get(0);

//Adding some sample value to cells

Cells cells = sheet.getCells();

Cell cell = cells.get(“A1”);

cell.setValue(50);

cell = cells.get(“A2”);

cell.setValue(100);

cell = cells.get(“A3”);

cell.setValue(150);

cell = cells.get(“A4”);

cell.setValue(150);
cell = cells.get(“A5”);

cell.setValue(150);
cell = cells.get(“A6”);

cell.setValue(150);
cell = cells.get(“A7”);

cell.setValue(150);

cell = cells.get(“B1”);

cell.setValue(4);

cell = cells.get(“B2”);

cell.setValue(20);

cell = cells.get(“B3”);

cell.setValue(50);

cell = cells.get(“B4”);

cell.setValue(50);
cell = cells.get(“B5”);

cell.setValue(50);
cell = cells.get(“B6”);

cell.setValue(50);
cell = cells.get(“B7”);

cell.setValue(50);

//Adding a sample value to “C1” cell as category data

cells.get(“C1”).setValue(“Q1”);

//Adding a sample value to “C2” cell as category data

cells.get(“C2”).setValue(“Q2”);

//Adding a sample value to “C3” cell as category data

cells.get(“C3”).setValue(“Y1”);

//Adding a sample value to “C4” cell as category data

cells.get(“C4”).setValue(“Y2”);
//
cells.get(“C5”).setValue(“Y3”);
cells.get(“C6”).setValue(“Y4”);
cells.get(“C7”).setValue(“Y5”);

ChartCollection charts = sheet.getCharts();

//Adding a chart to the worksheet

int chartIndex = charts.add(ChartType.BAR_3_D_CLUSTERED, 10, 0, 15, 5);

Chart chart = charts.get(chartIndex);

//Adding NSeries (chart data source) to the chart ranging from “A1” cell to “B3”

SeriesCollection serieses = chart.getNSeries();

serieses.add(“A1:B7”, true);
serieses.setCategoryData(“C1:C8”);
chart.getCategoryAxis().setTickLabelSpacing(1);

Hi,


Thanks for providing us the sample code.

I have tested your scenario/ case a bit and I observed the issue as you mentioned. The Axis.setTickLabelSpacing() is not working for XLS version although it works fine for XLSX file format. I have used the following sample code to try to accomplish the task but it does not work for XLS file format.
e.g
Sample code:

//Instantiating a Workbook object

Workbook workbook = new Workbook();

//Obtaining the reference of the first worksheet

WorksheetCollection worksheets = workbook.getWorksheets();

Worksheet sheet = worksheets.get(0);

//Adding some sample value to cells

Cells cells = sheet.getCells();

Cell cell = cells.get(“A1”);

cell.setValue(50);

cell = cells.get(“A2”);

cell.setValue(100);

cell = cells.get(“A3”);

cell.setValue(150);

cell = cells.get(“A4”);

cell.setValue(150);
cell = cells.get(“A5”);

cell.setValue(150);
cell = cells.get(“A6”);

cell.setValue(150);
cell = cells.get(“A7”);

cell.setValue(150);

cell = cells.get(“B1”);

cell.setValue(4);

cell = cells.get(“B2”);

cell.setValue(20);

cell = cells.get(“B3”);

cell.setValue(50);

cell = cells.get(“B4”);

cell.setValue(50);
cell = cells.get(“B5”);

cell.setValue(50);
cell = cells.get(“B6”);

cell.setValue(50);
cell = cells.get(“B7”);

cell.setValue(50);

//Adding a sample value to “C1” cell as category data

cells.get(“C1”).setValue(“Q1”);

//Adding a sample value to “C2” cell as category data

cells.get(“C2”).setValue(“Q2”);

//Adding a sample value to “C3” cell as category data

cells.get(“C3”).setValue(“Y1”);

//Adding a sample value to “C4” cell as category data

cells.get(“C4”).setValue(“Y2”);
//
cells.get(“C5”).setValue(“Y3”);
cells.get(“C6”).setValue(“Y4”);
cells.get(“C7”).setValue(“Y5”);

ChartCollection charts = sheet.getCharts();

//Adding a chart to the worksheet

int chartIndex = charts.add(ChartType.BAR_3_D_CLUSTERED, 10, 0, 15, 5);

Chart chart = charts.get(chartIndex);

//Adding NSeries (chart data source) to the chart ranging from “A1” cell to “B3”

SeriesCollection serieses = chart.getNSeries();

serieses.add(“A1:B7”, true);
serieses.setCategoryData(“C1:C8”);
chart.getCategoryAxis().setTickLabelSpacing(1);
chart.getCategoryAxis().setTickMarkSpacing(1);

workbook.save(“out1.xls”); //The tick labels spacing is still automatic
workbook.save(“out2.xlsx”, SaveFormat.XLSX); // OK

I have logged a ticket with an id “CELLSJAVA-40711” for your issue. We will look into your issue soon.

Once we have any update on it, we will let you know here.

Thank you.

Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells
for Java v7.7.1.3
and let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-40711) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.