Ticket T551319
Visible to All Users

How to set the sheet names for links

created 8 years ago

[DevExpress Support Team: CLONED FROM Q558905: WebChartControl : Export to Excel (xlsx) Sheet Name]
Hello,
when we use more than 1 link, how can we set the sheetnames to links?

Answers approved by DevExpress Support

created 8 years ago (modified 8 years ago)

Hello,

You can handle the PrintingSystemBase.XlSheetCreated event to define sheet names in the exported *.xlsx file. Here is a corresponding code snippet:

C#
// Assign the controls to the printing links. pcLink1.Component = this.gridControl1; pcLink2.Component = this.gridControl2; CompositeLink composLink = new CompositeLink(new PrintingSystem()); composLink.Links.Add(pcLink1); composLink.Links.Add(pcLink2); composLink.PrintingSystem.XlSheetCreated += PrintingSystem_XlSheetCreated; composLink.CreatePageForEachLink(); composLink.ExportToXlsx("document.xlsx", new XlsxExportOptions() { ExportMode = XlsxExportMode.SingleFilePageByPage }); ...... private void PrintingSystem_XlSheetCreated(object sender, XlSheetCreatedEventArgs e) { e.SheetName = "List" + e.Index.ToString(); }

Do not forget to set the XlsxExportOptions.ExportMode property to the XlsxExportMode.SingleFilePageByPage value.

Thanks,
Elliot

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.