This is a migrated thread and some comments may be shown as answers.

GridView ExportCommand

5 Answers 97 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 10 Aug 2016, 06:08 AM

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

Sort by
0
Stefan Nenchev
Telerik team
answered on 10 Aug 2016, 01:43 PM
Hello Rene,

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
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
ITA
Top achievements
Rank 1
answered on 23 Oct 2016, 01:35 PM

Hi,

thanks helped a lot, but how can i export some empty columns which are not in the GridView?

 

Thanks

Rene

0
ITA
Top achievements
Rank 1
answered on 23 Oct 2016, 03:04 PM

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

0
Stefan Nenchev
Telerik team
answered on 24 Oct 2016, 02:11 PM
Hi,

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
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
Sunil
Top achievements
Rank 1
answered on 24 Jun 2020, 10:20 AM

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.

Tags
GridView
Asked by
ITA
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
ITA
Top achievements
Rank 1
Sunil
Top achievements
Rank 1
Share this question
or