Solved

PRINT TO PDF OOCALC USING VB NET

Posted on 2012-12-20
4
622 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
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…

733 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