Setting a range of cells using an array

Is it possible to set the data for a range of cells using an array of data, all in one command, rather than setting each cell's data individually? For example (using C#), if i have a 50-element array of doubles, and I want to set cells B1:B50 to hold the 50 elements in that array, can this be done with one command, or must I set each cells from B1 to B50 individually? If it is possible, is it more efficient memory- and performance-wise than setting each cell individually?

4 Replies

MW Melba Winshia Syncfusion Team January 10, 2007 08:38 AM UTC

Hi Matt,

Use the following code snippets to set the data for a range of cells using an array.

[C#]

//Insert Array Formula
sheet.Range["A1:D1"].FormulaArray = "{1,2,3,4}";

Here is the sample for your reference:
Array.zip

Please take a look at the sample above and let me know if you have any other questions.

Thanks,
Melba


AD Administrator Syncfusion Team January 10, 2007 03:39 PM UTC

Actually there is ImportArray in the IWorksheet interface...


AD Administrator Syncfusion Team January 11, 2007 01:29 PM UTC

Hi,

ImportArray method is used to import an array of objects into a worksheet.

[C#]

double[] arrDouble = new double[] { 1.1, 1.2, 1.3, 1.4, 1.5 };
//Import array of objects.
sheet.ImportArray( arrDouble, 1, 1, true);

Here is the sample for your reference:

ImportArrayBoder.zip

Please take a look at the sample above and let me know if you have any other questions.

Thanks,
Melba



MW Melba Winshia Syncfusion Team January 11, 2007 01:30 PM UTC

Hi,

ImportArray method is used to import an array of objects into a worksheet.

[C#]

double[] arrDouble = new double[] { 1.1, 1.2, 1.3, 1.4, 1.5 };
//Import array of objects.
sheet.ImportArray( arrDouble, 1, 1, true);

Here is the sample for your reference:

ImportArrayBoder.zip

Please take a look at the sample above and let me know if you have any other questions.

Thanks,
Melba


Loader.
Up arrow icon