Hi Shakir,
Greetings from Syncfusion support.
You can use the Grid’s column template or value accessor(as you have used) functionality to render custom content in the Grid cells and customize its style. However these custom content and styles will not be exported to pdf file. This is because the Grid pdf export draws value on the exported document from the Grid data source and so it does not export custom content(template, value accessor) by default. This is the default behavior of the Grid based on its current architecture.
However you can export images/icons alone for the template columns by setting its corresponding base64 string to the value property of the pdfQueryCellInfo(Triggers for each cell before exporting to pdf) events as demonstrated in the below code snippet,
|
// Grid’s pdfQueryCellInfo event handlers
pdfQueryCellInfo(args) {
if (args.column.headerText === 'Employee Image') {
args.image = { base64: args.data["EmployeeImage"] };
}
} |
More details on this can be checked in the below online demo sample link,
Similarly for applying styles to the Grid cells on pdf export, you can use the same pdfQueryCellInfo event and apply required styles to the arguments style property. This requirement is logged in the below documentation link which you can check for more details,
So please check the above shared links and suggestions for customizing the Grid pdf exported document as per your requirement.
Let us know if you have any concerns.
Regards,
Sujith R