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. Image for the cookie policy date
close icon

Writing Range into an Excel Sheet

How can i write an entire range into an excel sheet row in Syncfusion?
PS[I have just switched from Interop to Syncfusion. And I am able to read an entire row into an Syncfusion.XlsIO.IRange[] array. However, I am stuck up in the process of writing an entire row. Is looping through all the cells the only way out? Just to mention, there was a performance lift of 4-5 times from reading entire row to reading cell by cell in case of Interop. So it makes all logical sense that Syncfusion also provides that feature.]


5 Replies

SR Sridhar Syncfusion Team May 7, 2012 10:47 AM UTC

Hi Amber,
 
Thank you very much for using Syncfusion products.
 
Could you please let me know whether you need to write a range or group of range (i.e., entire range) to an entire row.
 
However, Syncfusion Essential XlsIO supports for writing a range to an entire row of an worksheet. We have given below the code snippet for the same.
 
Code Snippet[C#]:
sheet.Range[2, 2].EntireRow.Value2 = sheet.Range["A1"];
sheet.Range[2, 2].EntireRow.Value = sheet.Range["A1"].DisplayText;
 
Could you please also get back to us with the source code used to write an entire range into an excel sheet row available with Interop so that we are able to proceed further on this.

Please let me know if you require any further assistance on this.
 
Thanks,
Sridhar.S
 


AM Amber May 11, 2012 06:55 AM UTC

Hi Sridhar, 
I want to write an entire row at once without looping. What you are doing here is that you are writing cell by cell in a row. So can't I write an entire array to a row without looping through that array?


SR Sridhar Syncfusion Team May 11, 2012 11:46 AM UTC

Hi Amber,

 

Thank you so much for the update.

 

Essential XlsIO, does not support to write the array of values to an Entire row without the loop. However, while looping through the cells we have an optimal method "IMigrantRange interface" for writing the strings with better performance.

 

We have given below the sample code snippet for the same.

 

Code Snippet [C#]:

 

IMigrantRange migrantRange = sheet.MigrantRange;

 

// Writing Data.

 

for (int row = 1; row <= rowCount; row++)

{

for (int column = 1; column <= colCount; column++)

{

// Writing values.

migrantRange.ResetRowColumn(row, column);

migrantRange.Text = "Test";

}

}

 

Please try the above code snippet and let us know if this helps you.

 

Also, please go through the following online documentation link for improving the performance while creating the excel reports.

 

http://help.syncfusion.com/UG/Reporting/XlsIO/ASP.NET/default.htm#!Documents/improvingperformance.htm

 

Please let me know if you require any further clarifications.

 

Thanks,

Sridhar.S



AM Amber May 12, 2012 06:17 AM UTC

Hey thanks Sridhar!


SR Sridhar Syncfusion Team May 14, 2012 08:33 AM UTC

Hi Amber,
 
Thanks for the update.
 
Please let me know if you require any further assistance on this.
 
Thanks,
Sridhar.S

Loader.
Live Chat Icon For mobile
Up arrow icon