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.

How to only set a bottom border for a range

Thread ID:

Created:

Updated:

Platform:

Replies:

100458 Aug 8,2011 03:28 PM Aug 9,2011 01:10 AM ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Mark Oudesluys
Asked On August 8, 2011 03:28 PM

Hi,

I am trying to apply a border to the bottom edge of a range of cells using the following code:

rBorder = wsPage.Range[iRow, iCol, iRow, maddCol];
rBorder.CellStyle.Borders.LineStyle = ExcelLineStyle.Thin;
rBorder.CellStyle.Borders[ExcelBordersIndex.DiagonalDown].Color = ExcelKnownColors.None;
rBorder.CellStyle.Borders[ExcelBordersIndex.DiagonalUp].Color = ExcelKnownColors.None;
rBorder.CellStyle.Borders[ExcelBordersIndex.EdgeLeft].Color = ExcelKnownColors.None;
rBorder.CellStyle.Borders[ExcelBordersIndex.EdgeRight].Color = ExcelKnownColors.None;
rBorder.CellStyle.Borders[ExcelBordersIndex.EdgeTop].Color = ExcelKnownColors.None;
rBorder.CellStyle.Borders[ExcelBordersIndex.EdgeBottom].Color = ExcelKnownColors.Black;

But I get all borders (top, bottom, left, right, diagonals) appearing, even through I specifically set the color of the other borders to None. Please see the attached Spreadsheet for an example of my output.

Any ideas?

Thanks,
Mark



BorderExample_f5289943.zip

John Bowlin Bosco K [Syncfusion]
Replied On August 9, 2011 01:10 AM

Hi Mark,

Thank you very much for your interest in Syncfusion Products.

While setting the color of specified border to None, the automatic color has been set to that particular border. To set the border to invisible, the line style property of borders must be set to None. To illustrate this, we have created a sample in which bottom border alone has been set by specifying its border line style and the sample has been attached below for your reference. Please find the sample and let me know your feedback.

Sample Link:
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=BorderTestSample-1790266587.zip

Code Snippet[C#]:

rBorder = wsPage.Range[iRow, iCol, iRow, maddCol]; rBorder.CellStyle.Borders[ExcelBordersIndex.DiagonalDown].LineStyle = ExcelLineStyle.None; rBorder.CellStyle.Borders[ExcelBordersIndex.DiagonalUp].LineStyle = ExcelLineStyle.None; rBorder.CellStyle.Borders[ExcelBordersIndex.EdgeLeft].LineStyle = ExcelLineStyle.None; rBorder.CellStyle.Borders[ExcelBordersIndex.EdgeRight].LineStyle = ExcelLineStyle.None; rBorder.CellStyle.Borders[ExcelBordersIndex.EdgeTop].LineStyle = ExcelLineStyle.None; rBorder.CellStyle.Borders[ExcelBordersIndex.EdgeBottom].LineStyle = ExcelLineStyle.Thin;

Please let us know if you need any further clarifications.

Regards,
Pauline Bosco


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.

;