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.

Setting Border Color and LineStyle Changes BackColor of nearest Cells

Thread ID:





88243 Jul 17,2009 12:17 PM Jul 23,2009 01:21 AM Windows Forms 2
Tags: XlsIO
Frederic Prevost
Asked On July 17, 2009 12:17 PM


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 01:05 PM

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 01:21 AM

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.

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.