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

Free Support Forum - aspose.com

SetOutlineBorder - does not support bitwise operations

Something I noticed about doing borders which is kinda a pain the way you implemented it.

var r = ws.Cells.CreateRange(tr, sc, sr - tr, 1);
r.SetOutlineBorder(BorderType.TopBorder, CellBorderType.Double, Color.Red);
r.SetOutlineBorder(BorderType.BottomBorder, CellBorderType.Double, Color.Red);
r.SetOutlineBorder(BorderType.LeftBorder, CellBorderType.Double, Color.Red);
r.SetOutlineBorder(BorderType.RightBorder, CellBorderType.Double, Color.Red);

This works, but I thought we would be able to bit-wise OR these together so I could write....

r.SetOutlineBorder(BorderType.TopBorder | BorderType.BottomBorder | etc....., CellBorderType.Double, Color.Red); // does not support ORing these even though they are powers of 2.

thanks
Marty

Hi Marty,

Thanks for your posting and using Aspose.Cells.

We will evaluate your requirement and see if such a bitwise OR operation could be supported for SetOutlineBorder() method.

We have logged this issue in our database for investigation. We will look into it and support it if possible. Once, there is some fix or other update for you, we will let you know asap.

This issue has been logged as CELLSNET-42807.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.1.1.1 and let us know your feedback.

Thanks Shakeel! You guys are awesome. I will try this in the next few days! This is great because it saves a lot of wordy code for formatting, which we do a lot of…

Marty

Hi Marty,

Thanks for your posting and using Aspose.Cells.

Hopefully, it will work fine at your end. I have tried it with the following code and it works fine. I have attached the output xlsx file generated by it for your reference.

Let us know if you encounter any issue, we will look into it and help you further.

C#


Workbook workbook = new Workbook();


Worksheet worksheet = workbook.Worksheets[0];


Range r = worksheet.Cells.CreateRange(“B2:C5”);


r.SetOutlineBorder(BorderType.TopBorder | BorderType.RightBorder, CellBorderType.Thick, Color.Red);


workbook.Save(“output.xlsx”);