Dev control learn-gridcontrol in Bandgridview Export multi-layer wardrobe operations

Source: Internet
Author: User

Bandgridview Exports Columns column header information By default, not bands column header information, in order to export multi-layered costumes. The code is as follows

1   Public Static voidExportExcel2 (DevExpress.XtraGrid.Views.BandedGrid.BandedGridView bandedgridview)2         {3SaveFileDialog SaveFileDialog =NewSaveFileDialog ();4Savefiledialog.title ="Export Excel";5Savefiledialog.filter ="Excel File (*.xlsx) |*.xlsx";6DialogResult DialogResult =Savefiledialog.showdialog ();7             if(DialogResult = =DialogResult.OK)8             {9DevExpress.XtraPrinting.XlsxExportOptionsEx op =NewDevExpress.XtraPrinting.XlsxExportOptionsEx ();Ten                  OneOp. Exporttype =DevExpress.Export.ExportType.WYSIWYG; ABandedGridView.OptionsPrint.PrintHeader =false; -BandedGridView.OptionsPrint.AutoWidth =false; - bandedgridview.exporttoxlsx (Savefiledialog.filename, op); theDevExpress.XtraEditors.XtraMessageBox.Show ("Save success! ","Tips", MessageBoxButtons.OK, messageboxicon.information); -             }   -}

There are several points to note:

1. There are two options: DevExpress.XtraPrinting.XlsxExportOptions and DevExpress.XtraPrinting.XlsxExportOptionsEx, need to use: D EvExpress.XtraPrinting.XlsxExportOptionsEx;

There are two ways of 2.devexpress.export.exporttype: Dataaware and WYSIWYG; The default is Dataaware, which needs to be set to WYSIWYG;
3.the default values for each property under Optionsprint are true, set Printheader = False (do not display column headers) and Autowidth = False (not adaptive width)

Dev control learn-gridcontrol in Bandgridview Export multi-layer wardrobe operations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.