How to remove left and right border in pivot table when exporting pdf

How can I not display the left border and right border? Referring to the code I have below, using border will display top, left, bottom and right border. But I just want the top and bottom to be in black. Any advise? Thank you in advance 



5 Replies

AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team June 28, 2022 02:58 PM UTC

Hi Yareesha,


We are validating this query with our internal grid team and will provide further details within two business days (June 30, 2022). 


Regards,

Angelin Faith Sheeba.



YA yareesha replied to AngelinFaithSheeba PaulvannanRajadurai June 29, 2022 07:06 AM UTC

Hi Angelin,

Thank you so much for your reply. Sure, ill wait. 


Thank you,

Yareesha



AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team June 30, 2022 11:32 AM UTC

Hi Yareesha,


We are validating this query with our internal PDF team and will provide further details within two business days (July 4, 2022). 


Regards,

Angelin Faith Sheeba.



YA yareesha replied to AngelinFaithSheeba PaulvannanRajadurai July 1, 2022 09:29 AM UTC

Hi Angelin,


Will be waiting for your reply. Thank you.


Regards,

Yareesha.



AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team July 4, 2022 02:15 PM UTC

Hi Yareesha,


Using pdfQueryCellInfo event, you can customize the borders of the pdf cells. Please refer the below code example:

Note: To set transparent color for right and left borders of cells, we have to set the same settings to its adjacent cells too. Four sides of cell borders are drawn with the flow of left, top, right and bottom respectively. Our actual behavior is “next cell left border is overlapped by current cell right border, and current cell left border is overlapped by before cell right border”.

Code Example:

pdfQueryCellInfo(args) {

    if (

      args.column.index !== 0 &&

      args.column.index !== args.cell.row.cells.cells.length + 2 //here, we add +2 because we have only 2 members in columns. If we have 3 members add +3 ans so on.

    ) {

      //Border color

      let colorPdfColor = new PdfColor(255255255);

      let color1PdfColor = new PdfColor(224224224);

      //Transparent border pen

      let penPdfPen = new PdfPen(color0);

      //grey border color

      let pen1PdfPen = new PdfPen(color11);

 

      let bordersPdfBorders = new PdfBorders();

      //Set tranparent border for adjacent cell right border of the cell which is located before the target cell.

      borders.right = pen;

      borders.left = pen;

      borders.top = pen1;

      borders.bottom = pen1;

      args.cell.style.borders = borders;

    } else if (args.column.index == args.cell.row.cells.cells.length + 2) {

      let colorPdfColor = new PdfColor(255255255);

      let color1PdfColor = new PdfColor(224224224);

 

      let penPdfPen = new PdfPen(color0);

      let pen1PdfPen = new PdfPen(color11);

 

      let bordersPdfBorders = new PdfBorders();

 

      borders.right = pen1;

      borders.left = pen;

      borders.top = pen1;

      borders.bottom = pen1;

      args.cell.style.borders = borders;

    }

  }


Meanwhile, we have prepared a sample for your reference.


Sample: https://stackblitz.com/edit/angular-vcmuqh?file=app.component.ts


Please see the below UG document for more information on the "pdfQueryCellInfo" event.


Document: https://ej2.syncfusion.com/angular/documentation/pivotview/pdf-export/#pdfquerycellinfo


Please let us know if you have any concerns.


Regards,

Angelin Faith Sheeba.


Loader.
Up arrow icon