How can I do that if I want to export a WebDataGrid to a custom stream or location? It seems to me with version 10.3 there is no way to do it using WebDocumentExporter.
Hi,
First you have to set the ExportMode to Custom:
<ig:WebDocumentExporter ID="WebDocumentExporter1" runat="server" ExportMode="Custom"></ig:WebDocumentExporter>
Then you can modify the following code to meet your requirements:
protected void btnExportPDF_Click(object sender, EventArgs e) { Report report = new Report(); WebDocumentExporter1.Export(WebDataGrid1, report);
// Create whatever stream you need. MemoryStream stream = new MemoryStream(); report.Publish(stream, FileFormat.PDF);
HttpResponse response = HttpContext.Current.Response; response.Clear(); response.AddHeader("content-disposition", "attachment; filename=report.pdf"); response.ContentType = "application/pdf"; response.Buffer = true; response.BinaryWrite(stream.ToArray()); response.Flush(); response.End(); }
Thanks a lot!
Now the next question:
Is there a way to merge two MemoryStreams into one using WebDocumentExporter?