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.

Borders

Thread ID:

Created:

Updated:

Platform:

Replies:

55010 Jan 22,2007 01:03 PM Jan 23,2007 05:42 AM Windows Forms 1
loading
Tags: XlsIO
William Brown
Asked On January 22, 2007 01:03 PM

Is it possible to determine the border properties of a cell, top, left etc from an existing sheet? For instance, I need to get all the border information from a cell on a template sheet then set only the top border of cell of the destination sheet.

Melba Winshia [Syncfusion]
Replied On January 23, 2007 05:42 AM

Hi Bill,

Thanks for your interest in Essential XlsIO.

Yes, it is possible to determine the border properties of a cell.

1) Please refer the following code snippet to set the border [top, bottom, left and right] linestyle.

[C#]

// Setting Border LineStyle - Bottom
sourcesheet.Range["B2"].CellStyle.Borders[ ExcelBordersIndex.EdgeBottom ].LineStyle =ExcelLineStyle.Dash_dot;

// Setting Border Linestyle - Left
sourcesheet.Range["B2"].CellStyle.Borders[ ExcelBordersIndex.EdgeLeft ].LineStyle = ExcelLineStyle.Dash_dot;

// Setting Border Linestyle - Right
sourcesheet.Range["B2"].CellStyle.Borders[ ExcelBordersIndex.EdgeRight ].LineStyle = ExcelLineStyle.Dash_dot;

// Setting Border Linestyle - Top
sourcesheet.Range["B2"].CellStyle.Borders[ ExcelBordersIndex.EdgeTop ].LineStyle = ExcelLineStyle.Dash_dot;

2) Please refer the following code snippet to get the border information from a cell and then set the top border of cell of the destination sheet.

[C#]

//Applying the border linestyle to the destination sheet.

destsheet.Range["B2"].CellStyle.Borders[ExcelBordersIndex.EdgeTop].LineStyle=sourcesheet.Range["B2"].CellStyle.Borders[ ExcelBordersIndex.EdgeTop ].LineStyle;

Please refer the following sample which implements the above said feature:

Borders.zip

Please take a look and let me know if you have any other questions.

Best Regards,
Melba

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.

;