0

I have an issue with LibreOffice base Printing reports from an external form. I try to make button function to print all report but failed.

Sub Reportstart(oEvent As Object)
Dim oField As Object
Dim oForm As Object
Dim oDocument As Object
Dim oDocView As Object
Dim Arg()
oField = oEvent.Source.Model
oForm = oField.Parent
sURL = oForm.DataSourceName
oDocument = StarDesktop.loadComponentFromURL(sURL, "C:\Users\Nameless\Desktop\Latest.odb", 0, Arg() )
oDocView = oDocument.CurrentController.Frame.ContainerWindow
oDocView.Visible = False
oDocument.getCurrentController().connect
Wait(100)
oDocument.ReportDocuments.getByName("report_student").open
oDocument.close(True)
End Sub
Micah
  • 3
  • 2

1 Answers1

0

The error is caused by loadComponentFromURL. We can't tell you what precisely the arguments should be for your project, but here is an example from https://ask.libreoffice.org/en/question/76947/how-to-open-base-reports-based-on-queries-in-standalone/:

Dim pProp(1) As New com.sun.star.beans.PropertyValue
pProp(0).Name = "ActiveConnection"
pProp(0).Value = oAConnection
pProp(1).Name = "OpenMode"
pProp(1).Value = "open"
oForm = dbForms.loadComponentFromURL(FormName, "_blank", 0, pProp())
Jim K
  • 12,824
  • 2
  • 22
  • 51