Back to Devexpress

ASPxGridBase.ExportToXls(Stream) Method

aspnet-devexpress-dot-web-dot-aspxgridbase-dot-exporttoxls-x28-system-dot-io-dot-stream-x29.md

latest2.8 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public void ExportToXls(
    Stream stream
)
vb
Public Sub ExportToXls(
    stream As Stream
)

Parameters

NameTypeDescription
streamStream

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

Note

Full example:

csharp
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

ASPxGridBase Class

ASPxGridBase Members

DevExpress.Web Namespace