Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
WD.Initialize
xui.SetDataFolder("Reports")
Dim n As Long = DateTime.Now
Dim doc As WordDocument = CreateDocument
Dim f As String = doc.SaveAs(xui.DefaultFolder, "Report.docx", True)
Log(DateTime.Now - n)
Log($"Document saved: ${f}"$)
'if MS Word is installed:
Label1.Text = "Creating PDF..."
'this step can be a bit slow. Comment it during development.
Wait For (WD.PowerShellConvertToPdf(File.Combine(xui.DefaultFolder, "Report.docx"), File.Combine(xui.DefaultFolder, "Report.pdf"), True)) Complete (Success As Boolean)
Label1.Text = "Opening word"
Wait For (WD.OpenWord(f)) Complete (Success As Boolean)
Label1.Text = "Report created: " & f
AnotherProgressBar1.Visible = False
End Sub