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

pdfgrid only border outside

I will create a Table in a PDF with Borders only outside

  PdfGrid  tabelle = new PdfGrid();
            tabelle.Style.BorderOverlapStyle = PdfBorders
            PdfGridRow row1 = tabelle.Rows.Add();
            PdfGridRow row2 = tabelle.Rows.Add();

            PdfGridCellStyle pdfGridCellStyle = new PdfGridCellStyle();
            //pdfGridCellStyle.Borders.Top = PdfPens.Black;
            //pdfGridCellStyle.Borders.Bottom = PdfPens.transparent;
            PdfGridCell pdfGridCell = tabelle.Rows[0].Cells[0];
            pdfGridCell.Style = pdfGridCellStyle;
            pdfGridCellStyle.Borders.Top = PdfPens.transparent;
            pdfGridCellStyle.Borders.Bottom = PdfPens.black;
             pdfGridCell = tabelle.Rows[1].Cells[0];
            pdfGridCell.Style = pdfGridCellStyle;
tabelle.Draw(page, new PointF(x, y+20));

1 Reply

SL Sowmiya Loganathan Syncfusion Team January 7, 2020 01:08 PM UTC

Hi Judith,  

Thank you for contacting Syncfusion support.  

We can achieve your requirement by hiding some borders of PdfGridCell with use of PdfCellStyle. Please refer the below code snippet for more details,  

//Specify the style for PdfGridCell 
PdfGridCellStyle cellStyle = new PdfGridCellStyle(); 
cellStyle.Borders.Bottom.Color = new PdfColor(Color.Transparent); 
//Apply cell style 
PdfGridCell cell = pdfGrid.Rows[0].Cells[0]; 
cell.Style = cellStyle; 

We have created the sample to achieve your requirement. Please find the same from below, 

Please try the sample in your end and let us know if you need any further assistance on this.  

Sowmiya Loganathan 

Live Chat Icon For mobile
Up arrow icon