PRINT TO PDF OOCALC USING VB NET

emi_sastra
emi_sastra used Ask the Experts™
on
Hi All,

I usually print report to oocalc.
I want to print it directly to pdf file after print to oocalc.
There is menu to at OpenOffice.Org.Calc to export it, but I want to export it using VB.NET

How could I do it ?

Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Many times it is helpful if you post your existing code so we can help adapt it.  Here is a sample that will open a blank calc document and save it as a pdf.  Hopefully you can glean what you need from it.  If not, then please post your existing code.

Dim objServiceManager As Object = CreateObject("com.sun.star.ServiceManager")
Dim objOODesktop As Object = objServiceManager.createInstance("com.sun.star.frame.Desktop")
Dim arg(-1) As Object
Dim objCalc As Object = objOODesktop.LoadComponentFromUrl("private:factory/scalc", "_blank", 0, arg)
Dim objSheet As Object = objCalc.Sheets.getByIndex(0)


Dim SaveParam(0) As Object
SaveParam(0) = MakePropertyValue(objServiceManager, "FilterName", "writer_pdf_Export")
objCalc.storetoURL("file:///E:/EETest/vbtest.pdf", SaveParam)
objCalc.Close(False)

Open in new window


-Bear

Author

Commented:
Hi Bear,

SaveParam(0) = MakePropertyValue(objServiceManager, "FilterName", "writer_pdf_Export")

Are these string variables, and should be change ?

1.  "FilterName"
2. "writer_pdf_Export"

Thank you.
Those are strings and need to be worded as exactly shown if you are wanting to save as a pdf.  You could set these as constants if you want your code to be more standardized.

-Bear

Author

Commented:
Great.

Thank you very much for your help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial