Free Support Forum - aspose.com

Problem with data cell references to sheet with comma in name

I am using Aspose.Cells for Java. Our released product is using 1.8.1.0 and I just tried it with 1.9.3.0.

Our application, in a workbook, creates a data sheet and a separate chart sheet which references the data sheet.

The sheet name is derived by what the user defines for his report name, which can contain punctuation including commas (i.e. they used the comma for a Europian decimal seperator) An example is: "PTMS01 - 2,000mps (Single)"

To set the data range for a series in the chart I create a data range using the following code:

/* Build string of the data range */
dataString = new StringBuilder("'");
dataString.append(dataSheetName + "'!" + cellName + ":" + lastCellName);

Then to add the series I do the following:

int iSeriesIndex = nSeries.add(dataString.toString(), false);

This results in a nullpointer exception.

If the dataSheetName does not include a comma then this works. I have tried to include the name in single quote and double quotes but nothing seems to allow accepting the comma.

The attachment includes the stackTrace from the top down to the last instruction called in our app. The last instruction before the exception is the nSeries.add above.

Steve

Hi,

Thanks for the details.

Yes we checked, if the worksheet name includes the comma, Aspose.Cells will take it as a part of data series range, not the worksheet name and try to sort it out.

We will check and figure it out soon.

Thank you.

I tried to make sure the sheet name was in single quotes hoping that it would ignore the comma between them.

It works OK to set the sheet name with a comma in it. (It should since Excel allows.)

wsData = worksheets.addSheet(SheetType.WORKSHEET, dataSheetName);

Where dataSheetName has a comma in it.

When I create a data range that references that dataSheetName and using it like the following:

nSeries.add(dataString.toString(), false);

I get a nullPointerException from within Aspose.

Steve

Hi Steve,

Please try this fix.

Hi Warren,

This didn't fix my problem, so I am trying to create a test set of code to duplicate. Unfortunately my test code works but my full set of actual code still fails. I guess you should wait until I can duplicate the problem with example code.

Steve

Sorry Warren,

Your fix did work.

I had 2 places in my code where I was creating the data range and I only changed one to have the data range string quoted. Of course the failure occurred at the other place.

Attached is a section of code that I could duplicate the problem with the old .jar file.

Do you know when the next release of Aspose.Cells for Java will be available with this fix?

Steve