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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





95217 Jun 27,2010 06:02 PM UTC Jun 29,2010 08:43 AM UTC ASP.NET Web Forms (Classic) 1
Tags: XlsIO
Kjell Ek
Asked On June 27, 2010 06:02 PM UTC

I import data into my present excelark through "sheet.ImportDataTable (dt, True, 10, 1, True)"
I do not know in advance how much data is available.
I want HAlignLeft from C10 and to the last row. How do I do that when I do not know the number of rows?

Now I use:
sheet.Range ("C10: C100").HorizontalAlignment = ExcelHAlign.HAlignLeft
But it can be more of a 100, I do not know it before.

And i want to set "Borders.LineStyle = ExcelLineStyle.Thin" from A10 to F10 and to the last row from my data...

I use: sheet.IsGridLinesVisible = False
I only want to have borders where my data is present (A10 to F10 and to the last row)

Geetha M [Syncfusion]
Replied On June 29, 2010 08:43 AM UTC

Hi Kjell,

Thank you for your interest in Syncfusion products.

You can create and define global styles for Border and Alignment separtely. Later, you can resuse them by referring to the style name alone.

Please refer the following link for assigning styles.

After the importing data, you can get the last row using IWorksheet.UsedRange.LastRow property.

int lRow = sheet.UsedRange.LastRow;

sheet[10,3,lRow,3].CellStyleName = "alignmentStyle"; // refer the created alignment style

Similarly, you can set borders as given in the code snippet:
sheet[10,1,10,6].CellStyleName = "borderStyle"; // refer the created borderstyle

Please try this and let us know if you have any questions.



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon