Solved

PRINT TO PDF OOCALC USING VB NET

Posted on 2012-12-20
4
628 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
ltlbearand3 earned 500 total points
ID: 38715019
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
ID: 38715157
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
ID: 38715801
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
ID: 38717725
Great.

Thank you very much for your help.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

728 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