i´m triying to customize columns width when i export my sfdatagrid to pdf, but it seems imposible to me, if that´s not possible i could use original column size but proportional to the page width.
any of this options is possible??
thanks in advanced
Hi Juan manuel,
You need to
customize the column width when exporting your DataGrid to a PDF. You can
achieve this using the CanExportColumnWidth exporting option. We have defined the columns
with different widths, and they exported correctly. We have shared a simple
sample and exported document for your reference.
Ug Link: CanExportColumnWidth
If you have any misunderstandings or if your needs differ, please
provide clear details about your use case. You can include additional
information regarding the expected behavior. This extra detail will enable us
to thoroughly address your request and provide an appropriate solution.
Regards,
Sethupathy D.
i see your sample and columns appears fine in pdf, BUT, i want to see them on screen in a different size, your columns when execute app appears so small, and that´s the problem have a different size on screen and on pdf, it would acceptable if it was proportional, por example, 200 on screen is half on pdf.
thanks again
these are my options, to export pdf
DataGridPdfExportingOption option = new()
{
CanFitAllColumnsInOnePage = true,
CanRepeatHeaders = true,
CanExportGroups = true,
CanExportHeader = true,
CanExportStackedHeaders = true,
CanExportTableSummary = true,
CanExportGroupSummary = true,
CanApplyGridStyle = false,
GridLineType = GridLineType.None,
CanExportColumnWidth = true,
CanExportSwitchColumnAsFormFields = true,
};
option.CanExportColumnWidth = true;
option.CanExportSwitchColumnAsFormFields = true;
you can see my screen, column looks cool
but my pdf is not good enough, there is so much space in paper to put email in 2 lines
Hi Juan manuel,
The reason the export is not matching the output dataGrid result is because the dataGrid is rendered in a window where the width is greater than the height. When exported to an A4 sheet, the height is greater than the width, which is the reverse. With the setting fitAllColumnInOnePage = true, the columns' widths are shared evenly to fit all the columns on one page, which causes the email column to be truncated. This is the expected behavior of DataGrid exporting.
We can resolve your query by setting the page orientation to landscape; by default, it is portrait. We have shared the modified code snippet and a simple sample for your reference.
Regards.
Sethupathy D.