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

Free Support Forum - aspose.com

How to get formulaR1C1 from chart.Nseries?

Hi!

I have this requirement

for(int i =0 ; i< chart.Nseries.count ; i++)
{
string R1C1= chart.Nseries[i].GetFormulaR1C1();

//do something…
}

Please tell me how to achieve this.

Thanks
Yashali

Hi Yashali,

Thanks for your posting and using Aspose.Cells.

You can convert your A1 formula into R1C1 formula using the CellsHelper.ConvertA1FormulaToR1C1() method.

Please see the following sample code. I have also attached the source Excel file used in this code and shown the Debug Output for your reference.

C#


String filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[0];


Chart chart = worksheet.Charts[0];


for (int i = 0; i < chart.NSeries.Count; i++)

{

Series nSrs = chart.NSeries[i];


string r1c1Formula = CellsHelper.ConvertA1FormulaToR1C1(nSrs.Values, 0, 0);


Debug.WriteLine(r1c1Formula);

}
Debug Output:
=Sheet1!R2C1:R10C1
=Sheet1!R2C2:R10C2

Hi!


Thanks for your reply. That helped!

Regards,
Yashali

Hi Yashali,

Thanks for your feedback and using Aspose.Cells.

It is good to know that CellsHelper.ConvertA1FormulaToR1C1() was helpful for you. Let us know if you encounter any other issue, we will be glad to look into it and help you further.