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
close icon

remove horizontal pdf grid border and change background color

I have a pdf document that i am creating using pdf grid and pdf grid row

the document has 20 pdf grid rows

row 1, 2 , 3 has 3 columns and data is placed in them either left or right justified.  I want to remove the top and bottom border and have the 3 grid rows to have a Yellow back ground color. I have not been able to remove the horizontal borders to make it look like a big header grid.

The other rows have 3 columns and i want to remove the top/bottom border on certain rows.



1 Reply

AS Abirami Selvan Syncfusion Team April 7, 2015 01:01 PM UTC

Hi Jb,

 

Thank you for using Syncfusion product.

 

We can set the background color using style.BackgroundBrush property and text can be justified in cell using PdfStringFormat.Alignment .

 

Please refer the below code snippet:

//String format

PdfStringFormat format=new PdfStringFormat();

 

//Alignment the text to right

format.Alignment=PdfTextAlignment.Right;

 

//Apply the background to the first 3 rows

pdfGrid.Rows[i].Style.BackgroundBrush = PdfBrushes.Yellow;

 

//Assign the format to particular cells

pdfGrid.Rows[i].Cells[j].StringFormat = format;

 

//Remove the bottom border for previous row

pdfGrid.Rows[i - 1].Cells[j].Style.Borders.Bottom = PdfPens.Transparent;

 

//Remove the top border from  row

pdfGrid.Rows[i].Cells[j].Style.Borders.Top = PdfPens.Transparent;

 

 

We have attached the sample for removing the grid row top/bottom borders in below link:

http://www.syncfusion.com/downloads/support/directtrac/137404/PdfGridBorderSample-1960878967.zip

 

Please try this and let us know if you have any further assistance .

 

Thanks,

Abirami.


Loader.
Live Chat Icon For mobile
Up arrow icon