OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

convert e sheet to pdf

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
BabyDoll
Guest





PostPosted: Mon Mar 29, 2004 6:12 am    Post subject: convert e sheet to pdf Reply with quote

Hello,

I would like to create a macro which convert a sheet(only one ) of document calc in pdf.

Can you help me?

BabyDoll
Back to top
PBiela
Power User
Power User


Joined: 10 Feb 2004
Posts: 56
Location: Frankfurt/Main Germany

PostPosted: Thu Apr 01, 2004 1:25 am    Post subject: Reply with quote

Hello BabyDoll,

This code from Andrew Pitonyak's Macro Dokument is the first step for your task.

Code:


'Author: Stephan Wunderlich [stephan.wunderlich@sun.com]
Sub CopySpreadsheet
  firstDoc = ThisComponent
  selectSheetByName(firstDoc, "Sheet2")
  dispatchURL(firstDoc,".uno:SelectAll")
  dispatchURL(firstDoc,".uno:Copy")
  secondDoc = StarDesktop.loadComponentFromUrl("private:factory/scalc","_blank",0,dimArray())
  secondDoc.getSheets().insertNewByName("inserted",0)
  selectSheetByName(secondDoc, "inserted")
  dispatchURL(secondDoc,".uno:Paste")
End Sub

Sub selectSheetByName(document, sheetName)
  document.getCurrentController.select(document.getSheets().getByName(sheetName))
End Sub

Sub dispatchURL(document, aURL)
  Dim noProps()
  Dim URL as new com.sun.star.util.URL

  frame = document.getCurrentController().getFrame()
  URL.Complete = aURL
  transf = createUnoService("com.sun.star.util.URLTransformer")
 transf.parseStrict(URL)

  disp = frame.queryDispatch(URL, "", com.sun.star.frame.FrameSearchFlag.SELF _
         OR com.sun.star.frame.FrameSearchFlag.CHILDREN)
  disp.dispatch(URL, noProps())
End Sub



Now use the FilterOptions to save the Document as a pdf. Descriebed in detail from DannyB
in this post or in the Code Snipplet Area.:

http://www.oooforum.org/forum/viewtopic.php?p=23135#23135


Hope this helped you. You can find Andrew Pitonyaks Document here:

http://www.pitonyak.org/AndrewMacro.sxw

Peter Biela
_________________
Question Who is John Galt? - Ayn Rand Question
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group