Export Dashboard

Stimulsoft Dashboards.WIN discussion
Post Reply
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

Export Dashboard

Post by ddsmith99301 »

I have Dashboards.win 2019.3.1. Is there any way to export a dashboard programmatically?
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

Re: Export Dashboard

Post by ddsmith99301 »

I want to clarify. I need to export a Dashboard to a pdf in a Winforms application. I currently have Dashboards.win 2019.3.1.
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: Export Dashboard

Post by Lech Kulikowski »

Hello,

Please check the following sample:
https://github.com/stimulsoft/Samples-D ... 0Dashboard

Thank you.
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

Re: Export Dashboard

Post by ddsmith99301 »

Thank you. My programming language is VB.net. I was able to convert it from c# and simplify it.

Here is the code I came up with for anyone that is interested.

Imports Stimulsoft.Report
Imports System.IO

Private Function GetDashboard() As StiReport
Dim reportPath = Application.StartupPath & "\Dashboards\Christmas.mrt"
Dim report = StiReport.CreateNewDashboard()
report.Load(reportPath)
Return report
End Function

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim report = Me.GetDashboard()
Dim fileName = If(String.IsNullOrEmpty(report.ReportAlias), report.ReportName, report.ReportAlias)
Dim file As New System.IO.FileStream(fileName & ".pdf", System.IO.FileMode.Create, System.IO.FileAccess.Write)
report.ExportDocument(StiExportFormat.Pdf, file)
file.Close()
End Sub
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: Export Dashboard

Post by Lech Kulikowski »

Hello,

Thank you for the provided code.
Post Reply