Can you save the report to PDF or HTML or any Pictureformat

Is there a way that you can save your report to PDF,HTML or any prictureformat.
I have a windows verision and want to distrubute my report.

/Anders

[154 byte] By [andersb79] at [2008-2-27]
# 1
In Beta 2 the only format you can export to is Excel. We are adding PDF export to the final version. In addition you will also be able to export to EMF format. HTML export is not supported.
RajeevKarunakaran at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 2
can you in code export it to Excel and put a file on the server?
andersb79 at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 3
Yes, you can programmatically export to any supported format.
RajeevKarunakaran at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 4
Can you give us some sample code on exporting to Excel?
jtwomley at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 5

using System;
using System.Data;
using System.IO;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

public class Demo : Form
{
private ReportViewer reportViewer;

private DataTable LoadSalesData()
{
// Load data from XML file
DataSet dataSet = new DataSet();
dataSet.ReadXml("data.xml");
return dataSet.Tables[0];
}

private void ExportMenuHandler(object sender, EventArgs e)
{
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string fileNameExtension;

byte[] bytes = reportViewer.LocalReport.Render(
"Excel", null, out mimeType, out encoding, out fileNameExtension,
out streamids, out warnings);

using (FileStream fs = new FileStream("output.xls", FileMode.Create))
{
fs.Write(bytes, 0, bytes.Length);
}

MessageBox.Show("Report exported to output.xls", "Info");
}

public void AddMenu()
{
MainMenu mainMenu = new MainMenu();
MenuItem fileMenu = new MenuItem("&File");
MenuItem exportItem = new MenuItem("&Export");
exportItem.Click += new EventHandler(ExportMenuHandler);
fileMenu.MenuItems.Add(exportItem);
mainMenu.MenuItems.Add(fileMenu);
this.Menu = mainMenu;
}

private void Form_Load(object sender, EventArgs e)
{
// Set Processing Mode
reportViewer.ProcessingMode = ProcessingMode.Local;

// Set RDL file
reportViewer.LocalReport.ReportPath = "Report1.rdlc";

// Supply a DataTable corresponding to each report data source
reportViewer.LocalReport.DataSources.Add(
new ReportDataSource("Sales", LoadSalesData()));

// Process and render the report
reportViewer.RefreshReport();
}

public Demo()
{
this.Text = "Report Control Demo";
this.ClientSize = new System.Drawing.Size(950, 600);

AddMenu();

reportViewer = new ReportViewer();
reportViewer.Dock = DockStyle.Fill;
this.Controls.Add(reportViewer);

this.Load += new System.EventHandler(this.Form_Load);
}

[STAThread]
public static int Main(string[] args)
{
Application.Run(new Demo());
return 0;
}
}

RajeevKarunakaran at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 6
What version is this available in? I don't have the option of using Render with 7 parameters.
jtwomley at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 7
Hi there,
The String fileNameExtension parameter of the Byte[] returning LocalReport.Render() overload is redundant in the version [which I suppose] that you have, too (if it's the same with my version, namely "Microsoft Visual C# 2005 55603-000-0000016-00273").
Simply comment this param (and the variable to which it is outputed), and it will work.
Regards,
Emil Prager
EmilPrager at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 8
is this for vs2005 reportViewer?
Delusion7 at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...

Visual Studio

Site Classified