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

How to only set a bottom border for a range

Thread ID:





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


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?



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

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:

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.

Pauline Bosco


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