We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Setting a range of cells using an array

Thread ID:

Created:

Updated:

Platform:

Replies:

54459 Jan 9,2007 10:47 AM Jan 11,2007 08:30 AM ASP.NET Web Forms (Classic) 4
loading
Tags: XlsIO
Matthew LeRoy
Asked On January 9, 2007 10:47 AM

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?

Melba Winshia [Syncfusion]
Replied On January 10, 2007 03:38 AM

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

Administrator [Syncfusion]
Replied On January 10, 2007 10:39 AM

Actually there is ImportArray in the IWorksheet interface...

Administrator [Syncfusion]
Replied On January 11, 2007 08:29 AM

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


Melba Winshia [Syncfusion]
Replied On January 11, 2007 08:30 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;