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.

Create excel report without specifying rows/column range number

Thread ID:

Created:

Updated:

Platform:

Replies:

121619 Jan 7,2016 09:09 PM Jan 11,2016 04:57 AM ASP.NET MVC (Classic) 3
loading
Tags: XlsIO
ov
Asked On January 7, 2016 09:09 PM

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.

worksheet.writeline(title1)
worksheet.writeline(title2)
worksheet.writeline(title3)

foreach(var value in values)
{
   worksheet.writeline(value.title1Value)
   worksheet.writeline(value.title2Value)
   worksheet.writeline(value.title3Value)
}

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.





Dilli Babu Nandha Gopal [Syncfusion]
Replied On January 8, 2016 08:51 AM

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.


Regards,

Dilli babu.


ov
Replied On January 8, 2016 08:59 AM


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.

Dilli Babu Nandha Gopal [Syncfusion]
Replied On January 11, 2016 04:57 AM

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.

Regards,
Dilli babu


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.

;