Solved

PRINT TO PDF OOCALC USING VB NET

Posted on 2012-12-20
4
609 Views
Last Modified: 2012-12-23
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.
0
Comment
Question by:emi_sastra
  • 2
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
ltlbearand3 earned 500 total points
Comment Utility
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
0
 
LVL 1

Author Comment

by:emi_sastra
Comment Utility
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.
0
 
LVL 20

Expert Comment

by:ltlbearand3
Comment Utility
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
0
 
LVL 1

Author Closing Comment

by:emi_sastra
Comment Utility
Great.

Thank you very much for your help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now