Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I try t export the grid to XLSX format and it does not work properly.

                                    - Run attached sample.
                                    - Click Export XLS. This works. All are exported in 1 worksheet which is what I am after.
                                    - Click Export XLSX Single File Page By Page. This will export it into multiple sheets. How can I get it to export it to 1 sheet only?
                                    - Click Export XLSX Single File. Nothing is exported.

                                    How can I get it to export it to XLSX format into 1 sheet just like the XLS format?

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hi Young,

                                The simplest way to create a single xlsx file is to use the GridControl.ExportToXlsx method. I have modified your sample to illustrate this approach. Is that what you are looking for?

                                Update

                                Our XLS export with the "Single File" option enabled is not a page-oriented export format. That is why it is not possible to use Page Merging facilities.
                                However, you can combine several links (With ChartControl and GridControl e.g.) or add Header and footers by using CompositeLink to show several controls in one export document.
                                Please review the modified sample in the attachment. It illustrates how it can be done.

                                See Also:
                                How to print a grid with an additional header and footer?
                                How to combine links via the CompositeLink

                                • Young Lim 05.09.2013

                                  Yes but this does not allow me to include headers right?

                                  Also, I may have a grid and a chart that I need to export into one file - this won't work right?

                                  Currently, using the printing system, I can do all the above - ie include headings, export grid then chart into one file. But the problem is it does not work for XLSX format.

                                  PDF, RTF and others works.

                                • Hello Young,

                                  Our XLS export with the "Single File" option enabled is not a page-oriented export format. That is why it is not possible to use Page Merging facilities.
                                  However, you can combine several links (With ChartControl and GridControl e.g.) or add Header and footers by using CompositeLink to show several controls in one export document.
                                  Please review the modified sample in the attachment. It illustrates how it can be done.

                                  See Also:
                                  How to print a grid with an additional header and footer?
                                  How to combine links via the CompositeLink

                                • Young Lim 05.12.2013

                                  Thanks.

                                  The header and footer is not printed for the Export XLS and Export XLSX options.

                                  Please see attached sample.

                                • Hello,

                                  It is necessary to add Headers&Footers to the CompositeLink to accomplish this task.
                                  For example:

                                  [VB.NET]
                                  Case btnExpXLSXSingleFile.Name Dim chartLink As New XtraPrinting.PrintableComponentLink chartLink.Component = ChartControl1 Dim mysv_obj_PageHF As XtraPrinting.PageHeaderFooter = TryCast(sv_obj_CompositeLink.PageHeaderFooter, XtraPrinting.PageHeaderFooter) mysv_obj_PageHF.Header.Content.Clear() mysv_obj_PageHF.Footer.Content.Clear() ' Add header. mysv_obj_PageHF.Header.Font = New Font("Tahoma", 10, FontStyle.Regular) mysv_obj_PageHF.Header.Content.AddRange(New String() {"", "ACME" & vbCrLf & "Sample Report", ""}) ' Add footer. mysv_obj_PageHF.Footer.Content.AddRange(New String() {"Blue Soft", "Date:[Date Printed] Time:[Time Printed]", "Pages:[Page # of Pages #]"}) mysv_obj_PageHF.Footer.LineAlignment = XtraPrinting.BrickAlignment.Far Dim sv_obj_ExportOptions As New XtraPrinting.XlsxExportOptions sv_obj_CompositeLink.Links.Add(sv_obj_PrintableComponentLink) sv_obj_CompositeLink.Links.Add(chartLink) sv_obj_CompositeLink.CreateDocument() sv_obj_ExportOptions.ExportMode = XtraPrinting.XlsxExportMode.SingleFile sv_obj_PrintableComponentLink.PrintingSystem.ExportToXlsx("TestSingle.xlsx", sv_obj_ExportOptions) Process.Start("TestSingle.xlsx")

                                  Please feel free to contact us if you need any additional assistance. We will be happy to help you.

                                  If you need to add a header only for a GridControl, add a special Link for it as shown in the How to print a grid with an additional header and footer? example.

                                You must  log in  or  register  to leave comments

                                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, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

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