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

Create excel report without specifying rows/column range number

Is there an easier way to create excel report without the need to manually write out the column/rows numbers?

I like a simple method like below.


foreach(var value in values)

There is the ImportData function that take a list but that does not do what I want so I need to loop through each values and apply custom values.

3 Replies

DB Dilli Babu Nandha Gopal Syncfusion Team January 8, 2016 01:51 PM UTC

Hi Ov,

We are not clear with your requirement. As far we have understood, you can set a named range for the cells you wanted to access. The following code example illustrates this behavior.

Code Snippet:

//Adding named range to the workbook           

IName workBookName = workbook.Names.Add("WorkBookName");

workBookName.RefersToRange = worksheet.Range["A1"];

//Looping through the Named Ranges in a workbook.

worksheet["WorkBookName"].Value = "Sample";

We have shared a sample for your reference which can be downloaded from following link

Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/NamedRange-1585087498

To know more about named range in XlsIO, kindly go through the following UG documentation link

UG Documentation link:  http://help.syncfusion.com/file-formats/xlsio/working-with-formulas#defined-names

The provided sample may help you if your requirement is similar. If not, please share us the requirement in detail to provide the solution at the earliest.


Dilli babu.

OV ov January 8, 2016 01:59 PM UTC

I am trying to avoid specifying the rang elike A1, A2. 
This is tricky to loop through.

I am looking for a simple method that just write and the library work out which row/columns it should go.

DB Dilli Babu Nandha Gopal Syncfusion Team January 11, 2016 09:57 AM UTC

Hi Ov,

The possible ways to access a cell or a range in a worksheet is explained briefly in the following UG documentation link. Kindly refer to this and let us know if this helps.

UG Documentation link: http://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#accessing-a-cell-or-a-range

If still you are not able to achieve your requirement, please share us a model or a screen-shot explaining your behavior, which will help us to provide a prompt solution.

Dilli babu

Live Chat Icon For mobile
Up arrow icon