We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Invalid data before reference sign '!': L|0-4|(L|5-8|)

I have updated our aspose version to 18.6.1.
I am facing some issue with setting chart series. I am getting error like “Invalid data before reference sign ‘!’: L|0-4|(L|5-8|)”.

I am adding worksheet dynamically name “Data(MV)”.
Workbook wb = new Workbook(new MemoryStream(Properties.Resources.AP_RelativeCharts));
Worksheet worksheetchartmv = wb.Worksheets[0];
Worksheet worksheetDur = wb.Worksheets[1];
Worksheet worksheetDataDur = wb.Worksheets[2];
worksheetDataDur.IsVisible = false;
Worksheet worksheetDataMV = wb.Worksheets[3];
worksheetDataMV.IsVisible = false;

The error it throws to me when I add series to chart.
String sheetName = “Data(Dur)”;
string alphaCode = “B”;
string seriesrange = string.Concat(sheetName, “!$”, alphaCode, “$2:$”, alphaCode, “$”, MaxDataRow + 1);
chart.NSeries.Add(seriesrange, true); //I get error here

I am able to resolve error by removing bracket from my worksheet name and making it “Data_MV”.
But what is the real issue behind this I am not able to understand. Please suggest me the proper solution for this.



Thanks for the code segment and details.

Could you also provide your template Excel file with sample code (runnable) to reproduce the issue, we will check it soon. You may also create a sample console demo application (runnable), zip the project and post us here to show the issue.

I got the solution. I have used the escape " ’ "(single quote) character.
For example.

chart.Nseries.Add(" ’ Data(MC) ’ ! A1:B45");


Good to know that you have sorted out your issue now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.