We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Border style

Hi Guys,

I have trouble with the styles of the borders.
When I use the following source code, the format of the borders is not changed.

var loadPath = @“C:\Users\MBerthold\Documents\TestArea\Aspose\Border\Border.xlsx”;
var savePath = @“C:\Users\MBerthold\Documents\TestArea\Aspose\Border\Result.xlsx”;

var myWorkbook = new Workbook(loadPath);
var mySheet = myWorkbook.Worksheets[myWorkbook.Worksheets.ActiveSheetIndex];

//Create Style
var style = myWorkbook.CreateStyle();
style.VerticalAlignment = TextAlignmentType.Center;
style.HorizontalAlignment = TextAlignmentType.Center;
style.Font.Color = Color.Green;
style.ShrinkToFit = true;

//Setting the bottom border color of the cell to red
style.Borders[BorderType.BottomBorder].Color = Color.Red;
style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Dotted;


//Creating StyleFlag
var styleFlag = new StyleFlag();
styleFlag.HorizontalAlignment = true;
styleFlag.VerticalAlignment = true;
styleFlag.ShrinkToFit = true;
styleFlag.BottomBorder = true;
styleFlag.FontColor = true;

var row = mySheet.Cells.Rows[0];
row.ApplyStyle(style, styleFlag);
myWorkbook.Save(savePath);

What am I doing wrong?
I use the current Version of Aspose Cells (17.1).
I have followed the example below.
http://www.aspose.com/docs/display/cellsnet/Apply+Styles+to+Ranges+in+Workbooks
My test document is Attached.

Thank you for your Support.

Hi there,


Thank you for sharing the sample.

I have evaluated the presented scenario while using the latest version of Aspose.Cells for .NET 17.1.8, and I am able to notice the said problem, that is; the code does not seem to work with your sample spreadsheet to change the style of existing border, however, it works if the input spreadsheet does not have borders set. I have raised this incident as CELLSNET-45101 in our bug tracking system for further investigation. Please spare us little time to properly analyze the scenario and get back with updates in this regard.

Hi,


This is to inform you that we have fixed your issue “CELLSNET-45101” now. We will soon provide the fix after performing QA and including other enhancements and fixes.

Thank you.

Hi,

thank you guys.

Hi,

Thanks for using Aspose.Cells.

Please download and try the following latest fix

Aspose.Cells for .NET v17.1.10 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.1.10 (.NET 4.0) compiled in .NET Framework 4.0.

and let us know your feedback.

Hi,

thanks for the current version, but I still see a problem.
If a border already exists and I change the first bottom border, I lost the left and right border (see screenshot).





Here my code:
var loadPath = @“C:\Users\MBerthold\Documents\TestArea\Aspose\Border\Border.xlsx”;
var savePath = @“C:\Users\MBerthold\Documents\TestArea\Aspose\Border\Result.xlsx”;

var myWorkbook = new Workbook(loadPath);
var mySheet = myWorkbook.Worksheets[myWorkbook.Worksheets.ActiveSheetIndex];

//Create Style
var style = myWorkbook.CreateStyle();
style.VerticalAlignment = TextAlignmentType.Center;
style.HorizontalAlignment = TextAlignmentType.Center;
style.Font.Color = Color.Green;
style.ShrinkToFit = true;

//Setting the bottom border color of the cell to red style.Borders[BorderType.BottomBorder].Color = Color.Red;
style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Dotted;

//Creating StyleFlag
var styleFlag = new StyleFlag();
styleFlag.HorizontalAlignment = true;
styleFlag.VerticalAlignment = true;
styleFlag.ShrinkToFit = true;
styleFlag.BottomBorder = true;
styleFlag.FontColor = true;

var row = mySheet.Cells.Rows[0];
row.ApplyStyle(style, styleFlag);
myWorkbook.Save(savePath);

Attached my test document.

Thank you for your support.

Hi again,


Thank you for sharing your feedback.

I have evaluated the recently shared scenario while using the latest version of Aspose.Cells for .NET 17.1.10, and I am able to notice the said problem (as per shared screenshot). In order to further investigate the matter, I have raised this incident as CELLSNET-45131 in our bug tracking system. Please spare us little time to further analyze the case and revert back with updates in this regard.

Hi again,


This is to inform you that the ticket logged earlier as CELLSNET-45131 has been marked resolved. We will shortly share the fix here for your testing.

The issues you have found earlier (filed as CELLSNET-45101) have been fixed in Aspose.Cells for .NET 17.2.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,

Good Job, it work´s
Thank you

Hi again,


Thank you for the confirmation. It is good to know that you are up & running again. Please feel free to contact us back in case you need our further assistance with Aspose APIs.