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
Solved

PRINT TO PDF OOCALC USING VB NET

Posted on 2012-12-20
4
617 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
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
VB.NET 1 28
Help with preventing downloading a zip file 10 45
VB.net capture  result of a SQL query in variables 3 20
Groupbox Control ? 2 17
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…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

839 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