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

Free Support Forum - aspose.com

Setting borders BorderSide enum missing FlagsAttribute


I have recently downloaded Aspose.Pdf and have encountered a problem when setting borders on a table/row.

The documentation is quite clear about how to set borders and I have followed this advice, however, I can't specify multiple borders using code as follows:

headerRow.Border = new BorderInfo((int)(BorderSide.Top | BorderSide.Bottom));

Further, my IDE displays the following warning:
"Bitwise operation on enum which is not marked by [Flags] attribute"

Which would be consistent with the behaviour I am seeing. The version of the assembly I am using is:

Is this version perhaps missing the [Flags] attribute?

Hello Craig,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

Let me share something related setting border of table. Please 1st try setting the value for DefaultCellBorder and then, you can change the table border settings at any particular point.


headerRow.DefaultCellBorder = new BorderInfo((int)BorderSide.Top | (int)BorderSide.Bottom);
headerRow.Border = new BorderInfo((int)BorderSide.Top | (int)BorderSide.Bottom);

I am unable to notice the [Flags] attribute issue. Please share the code, so that we can test the issue at our end.


That seems to have done it. Thanks

Just a small note, you can't boolean or (|) int's, so you have to:

((int)BorderSide.Top | BorderSide.Bottom)