Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / How to exclude some of the columns when exporting grid data in excel.

How to exclude some of the columns when exporting grid data in excel.

New Discussion
Mypost
Mypost asked on Mar 31, 2011 6:02 AM

Hi,

How can i exclude some of the Grid columns to export, when exporting UltraGrid data in excel.

Sign In to post a reply

Replies

  • 0
    Mike Saltzman
    Mike Saltzman answered on Jul 10, 2008 3:39 PM

    Use the BeginExport event on the UltraGridExcelExporter. This event will pass you a Layout, which is a clone of the grid layout. Since it's a clone, you can make changes to this layout and it will not affect the on-screen grid, only the export. So you can hide columns or band, change colors, or anything else you like.

    • 0
      Ken Villines
      Ken Villines answered on Mar 30, 2011 2:16 PM

      Hi Mike,

      If there are two bands but I only want band[0] to export, how can I make that happen?

      thanks

      -Ken

      • 0
        Mypost
        Mypost answered on Mar 31, 2011 5:56 AM

        Hi,
        you can hide the Band in BeginExport event of UltraGridExporter

        like this

         private void OnGridBeginExport(object sender, BeginExportEventArgs e) {
            e.Layout.Bands[1].Hidden=true;
            }

         

      • 0
        Ken Villines
        Ken Villines answered on Mar 31, 2011 6:02 AM

        Yes, I tried that but the Excel Exporter throws an error stating a key isn't found. I assume it is still trying to use the Band[1] column keys during export.

        I am going to try this to see if I can get around it.

         private void OnInitializeRowDataExcelExporter(object sender, ExcelExportInitializeRowEventArgs e)
         {
             e.SkipDescendants = SkipChildBandExcelExport;
         }
  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Mypost
Favorites
0
Replies
4
Created On
Mar 31, 2011
Last Post
14 years, 11 months ago

Suggested Discussions

Created by

Created on

Mar 31, 2011 6:02 AM

Last activity on

Feb 23, 2026 2:59 PM