This is a migrated thread and some comments may be shown as answers.

Proper way to set table borders when exporting to PDF?

3 Answers 318 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kjell
Top achievements
Rank 1
Kjell asked on 25 Apr 2012, 02:20 AM
Before updating to the latest build and SL5, I would set table borders like this:

var headCell = headtable.Rows.First.Cells.First;

 

headCell.Borders.All = Telerik.Windows.Documents.Model.Border(0, BorderStyle.None, Colors.White);


The above would give me no borders.  This property became read only in the new stuff, so I started using Borders.SetTop(), Borders,SetBottom(), etc.  However it doesn't seem to do anything, I always get a single black border around all my cells. Here is an example of how I am trying to use SetTop:

 

headCell.Borders.SetTop(

 

new Telerik.Windows.Documents.Model.Border(0,BorderStyle.None, Colors.White));



What is the correct way to set the borders in the latest build?  I am using the 4/16 internal DLLs.

 

 

 

3 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 25 Apr 2012, 09:58 AM
Hi Kjell,

Thank you for contacting us about this issue. This is a minor breaking change, which unfortunately is not well documented.
You can set the table borders like this:

cell.Borders = new TableBorders(new Telerik.Windows.Documents.Model.Border(BorderStyle.None));
//or
table.Borders = new TableBorders(new Telerik.Windows.Documents.Model.Border(BorderStyle.None));

We will make sure to include this point in our online help.

Regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Kjell
Top achievements
Rank 1
answered on 25 Apr 2012, 06:03 PM
Thanks for the quick response, but what if I want to set just the Top border for example?
0
Iva Toteva
Telerik team
answered on 27 Apr 2012, 09:16 AM
Hi Kjell,

In that case you can use one of the overloads of the constructor of TableBorders (for the borders of the whole table) or TableCellBorders (for the borders of a specific cell).
Here is an example:

Telerik.Windows.Documents.Model.Border leftBorder = new Telerik.Windows.Documents.Model.Border(BorderStyle.Single, Colors.Blue);
Telerik.Windows.Documents.Model.Border topBorder = new Telerik.Windows.Documents.Model.Border(BorderStyle.None, Colors.White);
Telerik.Windows.Documents.Model.Border rightBorder = new Telerik.Windows.Documents.Model.Border(BorderStyle.Single, Colors.Red);
Telerik.Windows.Documents.Model.Border bottomBorder = new Telerik.Windows.Documents.Model.Border(BorderStyle.Single, Colors.Green);
 
cell00.Borders = new TableCellBorders(leftBorder, topBorder, rightBorder, bottomBorder);
//or
table.Borders = new TableBorders(leftBorder, topBorder, rightBorder, bottomBorder);

I hope this answers your question.

Greetings,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Kjell
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Kjell
Top achievements
Rank 1
Share this question
or