This project has moved. For the latest updates, please go here.

Does ExcelRange.Value support an object array?

Nov 8, 2010 at 4:06 PM

Thank you for your excellent library.

I am converting a web report in EPPlus that was originally written and working using Interop.
When I try the following code, I don't get the results I expected.
Am I using EPPlus correctly?

object[,] oData = new object[2, 3];
for (int j = 0; j < oData.GetUpperBound(0) + 1; j++) {
   for (int i = 0; i < oData.GetUpperBound(1) + 1; i++) {
      oData[j, i] = "";
   }
}

ExcelRange rg = worksheet.Cells["A27"];
oData[0, 1] = "Data in Object Array";
rg = worksheet.Cells["A27"];
rg.Value = oData;  // Result in spreadsheet: System.Object[,]
worksheet.Cells["A28"].Value = oData;  // Result in spreadsheet: System.Object[,]
worksheet.Cells["A29"].Value = "Data in Object Array"; // Result is as expected.

Thank you.

Coordinator
Nov 9, 2010 at 6:40 AM

Hi,

I have no support for setting multiple values using an array, but that is actully a good idea.

I'll add it to my TODO list

Jan

Nov 9, 2010 at 12:44 PM

Thank you Jan.