Skip to main content
Tab

ASPxGridBase.ExportToXls(Stream) Method

Exports the control’s data to the specified stream in XLS format using the specified options.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

public void ExportToXls(
    Stream stream
)

Parameters

Name Type Description
stream Stream

A Stream object, to which the created document is exported.

Remarks

This method indirectly calls the PrintingSystemBase.ExportToXls method of the XtraPrinting Library. If this library is not available the method does nothing. For details on the ExportToXls method, see the PrintingSystemBase.ExportToXls topic.

Concept

Export

Online Demo

ASPxGridView - Export To Different Formats

Example

protected void ExportButton_Click(object sender, EventArgs e) {
    PrintingSystemBase ps = new PrintingSystemBase();

    PrintableComponentLinkBase link1 = new PrintableComponentLinkBase(ps);
    link1.Component = GridExporter1;

    PrintableComponentLinkBase link2 = new PrintableComponentLinkBase(ps);
    link2.Component = GridExporter2;

    CompositeLinkBase compositeLink = new CompositeLinkBase(ps);
    compositeLink.Links.AddRange(new object[] { link1, link2 });

    compositeLink.CreateDocument();
    using(MemoryStream stream = new MemoryStream()) {
        compositeLink.ExportToXls(stream);
        WriteToResponse("filename", true, "xls", stream);
    }
    ps.Dispose();
}
See Also