string fileName = null;
WriterFormat format;
HttpContext httpContext = System.Web.HttpContext.Current;
ReportWriter reportWriter = new ReportWriter();
reportWriter.ReportPath = "/Sample Reports/Company Sales";
reportWriter.ReportServerUrl = "http://reportserver.syncfusion.com:80/";
reportWriter.ReportingServer = new ReportingServerExt();
reportWriter.ReportServerCredential = new System.Net.NetworkCredential("guest", "demo");
reportWriter.ReportProcessingMode = ProcessingMode.Remote;
if (writerFormat == "PDF")
{
fileName = "Company Sales.pdf";
format = WriterFormat.PDF;
}
else if (writerFormat == "Word")
{
fileName = "Company Sales.doc";
format = WriterFormat.Word;
}
else if (writerFormat == "Html")
{
fileName = "Company Sales.Html";
format = WriterFormat.HTML;
}
else
{
fileName = "Company Sales.xls";
format = WriterFormat.Excel;
}
reportWriter.Save(fileName, format, httpContext.Response);