Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hi Team,




                                    Here my requirement is to export data in the grid control to Excel sheet.


                                    GridView.ExportToXls() is working fine, but that is exporting only the data in the UI or only visible columns.



                                    Could you please suggest me an option to export all the columns associated to the grid control i.e., all the hidden as well as visible columns.



                                    Its really urgent for me... Thanks In Advance.

                                2 Solutions

                                Creation Date Rating Importance Sort by
                                0

                                Hi,

                                Brendon is right, the GridControl's content is printed/exported using the WYSIWYG principle.

                                As for implementation of the mentioned requirements, you can use the GridView's "Saving and Restoring layout" functionality.

                                Look at the following code snippet:

                                [C#]
                                gridView1.SaveLayoutToXml("tempLayout.xml"); foreach (GridColumn column in gridView1.Columns) { column.Visible = true; } gridView1.ExportToXls("export.xls"); gridView1.RestoreLayoutFromXml("tempLayout.xml");

                                I hope you find this information helpful.

                                • Amjad Ali 09.27.2012

                                  Hi DevExpress team,

                                  Thank you very much for the responses. The solution from Brendon was very much helpful. It served the purpose.

                                  Thank you very much once again

                                0

                                ´╗┐The GridControl uses a WYSIWYG export routine. In order to export/print all of the grid's columns, you will have to set them all to Visible before exporting. My suggestion is to loop through all of the grid's columns, set them to visible, exporting/print the GridControl, and then hide the columns again.

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners