R1C1Forumla

Hello,

I would use the r1c1 formula to insert a string value wioth "'" in a cell.

The excell macro wrote cells.R1C1Formula = "'\Pippo" and it works fine; but if I use this standar with aspose i doesn't work!!! why? how I cane make IT??

Thank's

Hi,

Well you may utilize Escape char i.e., \" to embed double quotes into your formulas

I write here a simple winform example for your need:

Workbook workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];

Cells cells = worksheet.Cells;

//Input some values into the cells.

cells["C2"].PutValue(2);

cells["D2"].PutValue(1);

cells["E2"].PutValue(4);

cells["C3"].PutValue(3);

cells["D3"].PutValue(4);

cells["E3"].PutValue(6);

//Set the R1C1 Formula

cells["A1"].R1C1Formula = "=IF(SUM(R[1]C[2]:R[2]C[4])>18,\"Pippo\",\"Not Pippo\")";

workbook.CalculateFormula();

MessageBox.Show("Formula String: " + cells["A1"].R1C1Formula);

MessageBox.Show("Value: " + cells["A1"].StringValue);

//Save the excel file.

workbook.Save("d:\\test\\tstr1c1formula.xls");

Thank you.