aspnet-devexpress-dot-web-dot-aspxgridbase-dot-exporttoxls-x28-system-dot-io-dot-stream-x29.md
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
public void ExportToXls(
Stream stream
)
Public Sub ExportToXls(
stream As Stream
)
| Name | Type | Description |
|---|---|---|
| stream | Stream |
A Stream object, to which the created document is exported.
|
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.
ASPxGridView - Export To Different Formats
Note
Full example:
Web Forms: How to combine a number of ASPxGridView documents in one when exporting
MVC: How to export multiple GridViews into a single print document
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