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

Free Support Forum - aspose.com

Add a formula to a cell

Hi,

I am trying to add a formula to a cell in C# .NET 2008 (targeting the 2.0 framework) like so:

statsDataRange[0, 13].Formula = “=1”;

Where statsDataRange is a Range, but I get the runtime error “Value does not fall within the expected range.” What am I doing wrong? If this is not the correct way to reference a cell within a range, what is?

Thanks much,
Christine Coder

Hi,

I think the range column count is less than 13. the params of Range[int rowIndex,int columnIndex] are offset in the range,not the really row/column index in the worksheet.

Oh, you’re quite right. Being zero based, the index of the last column was 12, not 13. Doh! Thanks,

-Christine Coder