PBiela Power User


Joined: 10 Feb 2004 Posts: 56 Location: Frankfurt/Main Germany
|
Posted: Thu Apr 01, 2004 1:25 am Post subject: |
|
|
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 _________________
Who is John Galt? - Ayn Rand  |
|