Hi,
i use a RadView with an ItemSource ViewModel and several RadGridViewColumns. Also i created a Button bound to the ExportCommand which works fine.
The performance is not very well, but ok. My questions: Is it possible to export only defined Columns and not all out of the GridView? The Problem is, that i have about 20 Columns and in the pdf is looks like a mass.
Thanks
Best regards
Rene
5 Answers, 1 is accepted
Please have a look at the following article - How to Disable the Export of a Particular Column - which shows how to achieve the behavior when using the ExportToXlsx and ExportToPdf methods.
Regards,
Stefan Nenchev
Telerik by Progress
Hi,
thanks helped a lot, but how can i export some empty columns which are not in the GridView?
Thanks
Rene
Hi,
solved, but one last Questions. How do i add some GrindLines to the exported pdf? I Use the "GridLinesVisibility="Both""
Property in my GridView, but on my Document they are not visible?!
Thanks
Rene
Please check the following article - Style Exported XLSX & PDF documents. You can apply the following, in order to set borders to the exported cells:
private
void
clubsGrid_ElementExportingToDocument(
object
sender, GridViewElementExportingToDocumentEventArgs e)
{
if
(e.Element == ExportElement.Cell)
{
(e.VisualParameters
as
GridViewDocumentVisualExportParameters).Style =
new
Telerik.Windows.Controls.GridView.CellSelectionStyle()
{
CellBorders = CellBorders.CreateOutline(
new
CellBorder(CellBorderStyle.Medium,
new
ThemableColor(Colors.Black))),
ForeColor =
new
ThemableColor(Colors.Green),
};
}
}
Regards,
Stefan Nenchev
Telerik by Progress
Hi,
I referred to the post, However when i opened the exported excel file, All the cells were crossed with the defined theme color.
Can you please look into this?
Below is my code snippet.
if (e.Element == ExportElement.HeaderCell)
{
(e.VisualParameters as GridViewDocumentVisualExportParameters).Style = new CellSelectionStyle()
{
CellBorders = new CellBorders(new CellBorder(CellBorderStyle.Medium, new ThemableColor(Colors.Black)))
};
}
if (e.Element == ExportElement.Cell)
{
(e.VisualParameters as GridViewDocumentVisualExportParameters).Style = new CellSelectionStyle()
{
CellBorders = new CellBorders(new CellBorder(CellBorderStyle.Medium, new ThemableColor(Colors.Black)))
};
}
Also find the attached pic exported content.