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

Setting Border Color and LineStyle Changes BackColor of nearest Cells

Thread ID:





88243 Jul 17,2009 04:17 PM UTC Jul 23,2009 05:21 AM UTC WinForms 2
Tags: XlsIO
Frederic Prevost
Asked On July 17, 2009 04:17 PM UTC


I'm using Syncfusion Essential studio Xlsio.Base version
I'm creating an Excel 2003 file. When I change the color and the Line style of the Borders of A cell, it changes the BackColor of the cell too.
Here is the code I'm using:

internal static void ApplyTableStyle( IRange pTableRange, IStyle pTableStyle ) {

if ( pTableRange != null ) {
IBorder border = pTableRange[pTableRange.Row, pTableRange.Column, pTableRange.Row, pTableRange.LastColumn].Borders[ExcelBordersIndex.EdgeTop];
IBorder borderModel = pTableStyle.Borders[ExcelBordersIndex.EdgeTop];
pTableRange.BorderAround(borderModel.LineStyle, borderModel.Color);
border.LineStyle = borderModel.LineStyle;
border.Color = borderModel.Color;

border = pTableRange[pTableRange.Row, pTableRange.Column, pTableRange.LastRow, pTableRange.Column].Borders[ExcelBordersIndex.EdgeLeft];
borderModel = pTableStyle.Borders[ExcelBordersIndex.EdgeLeft];
border.LineStyle = borderModel.LineStyle;
border.Color = borderModel.Color;

border = pTableRange[pTableRange.Row, pTableRange.LastColumn, pTableRange.LastRow, pTableRange.LastColumn].Borders[ExcelBordersIndex.EdgeRight];
borderModel = pTableStyle.Borders[ExcelBordersIndex.EdgeRight];
border.LineStyle = borderModel.LineStyle;
border.Color = borderModel.Color;

border = pTableRange[pTableRange.LastRow, pTableRange.Column, pTableRange.LastRow, pTableRange.LastColumn].Borders[ExcelBordersIndex.EdgeBottom];
borderModel = pTableStyle.Borders[ExcelBordersIndex.EdgeBottom];
border.LineStyle = borderModel.LineStyle;
border.Color = borderModel.Color;

Notice that this code worked fine with the 6.3 version of Xlsio

Frederic Prevost
Replied On July 20, 2009 05:05 PM UTC

I succeeded in reproducing the problem. And I created a Visual Studio 2008 Solution.
In fact the problem appears when I try to apply many styles successively to the same cell.
In my example I try to apply A back color to a cell using a first style, then a font using another style and at last the border style and it doesn't works.


Vijesh Narayanan [Syncfusion]
Replied On July 23, 2009 05:21 AM UTC

Hi Khonsort,

Thank you for using Essential XlsIO.

The issue 'Setting Border Color and LineStyle Changes BackColor of nearest Cells' reported by you is suspected to be a defect. Could you please follow Direct Trac Incident #58227 for further updates on this?



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

This page will automatically be redirected to the 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