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. Image for the cookie policy date

Setting Border Color and LineStyle Changes BackColor of nearest Cells

Hi,

I'm using Syncfusion Essential studio Xlsio.Base version 7.2.0.37.
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


2 Replies

FP Frederic Prevost 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.




FormatRead_dc85c487.zip


VN Vijesh Narayanan Syncfusion Team 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?

Regards,
Vijesh

Loader.
Live Chat Icon For mobile
Up arrow icon