Page 1 of 1

Export Dashboard

Posted: Fri Jul 16, 2021 6:54 pm
by ddsmith99301
I have Dashboards.win 2019.3.1. Is there any way to export a dashboard programmatically?

Re: Export Dashboard

Posted: Fri Jul 16, 2021 9:39 pm
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.

Re: Export Dashboard

Posted: Mon Jul 19, 2021 6:15 pm
by Lech Kulikowski
Hello,

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

Thank you.

Re: Export Dashboard

Posted: Mon Jul 19, 2021 9:14 pm
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

Re: Export Dashboard

Posted: Mon Jul 19, 2021 9:19 pm
by Lech Kulikowski
Hello,

Thank you for the provided code.