This example shows how to export a dashboard. First, you need to load dashboard template:
...

	private StiReport GetTemplate()
	{
		var report = StiReport.CreateNewDashboard();
		report.Load("Dashboards\\DashboardChristmas.mrt");
		return report;
	}

...

Next, use ExportDocument() method to export the dashboard to format you need:
...

	private void buttonPdf_Click(object sender, EventArgs e)
	{
		var report = GetTemplate();
            
		saveFileDialog.FileName = report.ReportName + ".pdf";
		if (saveFileDialog.ShowDialog() == DialogResult.OK)
		{
			var stream = new FileStream(saveFileDialog.FileName, FileMode.OpenOrCreate);
			report.ExportDocument(StiExportFormat.Pdf, stream);
			stream.Close();
		}
	}

	private void buttonExcel_Click(object sender, EventArgs e)
	{
		var report = GetTemplate();

		saveFileDialog.FileName = report.ReportName + ".xlsx";
		if (saveFileDialog.ShowDialog() == DialogResult.OK)
		{
			var stream = new FileStream(saveFileDialog.FileName, FileMode.OpenOrCreate);
			report.ExportDocument(StiExportFormat.Excel2007, stream);
			stream.Close();
		}
	}

	private void buttonImage_Click(object sender, EventArgs e)
	{
		var report = GetTemplate();

		saveFileDialog.FileName = report.ReportName + ".png";
		if (saveFileDialog.ShowDialog() == DialogResult.OK)
		{
			var stream = new FileStream(saveFileDialog.FileName, FileMode.OpenOrCreate);
			report.ExportDocument(StiExportFormat.ImagePng, stream);
			stream.Close();
		}
	}
	
...

Auf dem Screenshot unten Sie können das Ergebnis des Beispiel-Codes ansehen:

Exporting a Dashboard

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.