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

sheet.Range

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)

1 Reply

GM Geetha M Syncfusion Team 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.
http://help.syncfusion.com/ug_82/reporting_xlsio/GlobalStyles.html

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.

Regards,
Geetha

Loader.
Live Chat Icon For mobile
Up arrow icon