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

save as pdf only a selection of cells

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


Joined: 24 Jan 2008
Posts: 23
Location: carcare, savona, italia

PostPosted: Sat Jul 31, 2010 4:53 am    Post subject: save as pdf only a selection of cells Reply with quote

hi,
I wanted to know how you could save a selection of cells in a Calc spreadsheet into a pdf file ..
I tried with this code
Code:

dim document   as object
dim dispatcher as object
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$1:$g$54"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dim args2(2) as new com.sun.star.beans.PropertyValue
args2(0).Name = "URL"
args2(0).Value = Path + "/fatture/" + data + "/" + oNumero + " " + oNome + ".pdf"
args2(1).Name = "FilterName"
args2(1).Value = "calc_pdf_Export"
args2(2).Name = "FilterData"
args2(2).Value = Array(Array("UseLosslessCompression",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Quality",0,90,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ReduceImageResolution",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("MaxImageResolution",0,300,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("UseTaggedPDF",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("SelectPdfVersion",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportNotes",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportBookmarks",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("OpenBookmarkLevels",0,-1,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("UseTransitionEffects",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("IsSkipEmptyPages",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("IsAddStream",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("FormsType",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportFormFields",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("HideViewerToolbar",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("HideViewerMenubar",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("HideViewerWindowControls",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ResizeWindowToInitialPage",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("CenterWindow",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("OpenInFullScreenMode",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("DisplayPDFDocumentTitle",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("InitialView",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Magnification",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Zoom",0,100,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PageLayout",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("FirstPageOnLeft",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("InitialPage",0,1,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Printing",0,2,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Changes",0,4,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("EnableCopyingOfContent",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("EnableTextAccessForAccessibilityTools",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportLinksRelativeFsys",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PDFViewSelection",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ConvertOOoTargetToPDFTarget",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportBookmarksToPDFDestination",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("_OkButtonString",0,"",com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("EncryptFile",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("DocumentOpenPassword",0,"",com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("RestrictPermissions",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PermissionPassword",0,"",com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Selection",0,,com.sun.star.beans.PropertyState.DIRECT_VALUE))
dispatcher.executeDispatch(document, ".uno:ExportToPDF", "", 0, args2())

I was created automatically by a rec macro ..
I just changed the path and file name of facts that is saved in pdf format where I want and with the right name, but not the selection but the whole package.
there a solution?
thanks
_________________
http://www.nasosan.it
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Sat Jul 31, 2010 5:16 am    Post subject: Reply with quote

see
http://www.oooforum.org/forum/viewtopic.phtml?t=102934
Back to top
View user's profile Send private message
nasosan
General User
General User


Joined: 24 Jan 2008
Posts: 23
Location: carcare, savona, italia

PostPosted: Sun Aug 01, 2010 12:35 am    Post subject: Reply with quote

hi dont want to export a sheet.. but a selection...
_________________
http://www.nasosan.it
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
floris_v
Moderator
Moderator


Joined: 12 Jul 2007
Posts: 4791
Location: Netherlands

PostPosted: Sun Aug 01, 2010 1:33 am    Post subject: Reply with quote

Well, you can start a new document, paste in the selection there, then export the new doc to PDF. It's a bit roundabout, but who cares about that if it works?
_________________
LibreOffice 3.6.3; OOo 3.4.1 on Windows Vista
Join the Official community forum - in several languages, including Nederlandstalig forum
Back to top
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Sun Aug 01, 2010 1:48 am    Post subject: Reply with quote

nasosan wrote:
hi dont want to export a sheet.. but a selection...

http://www.oooforum.org/forum/viewtopic.phtml?p=385443#385443
Back to top
View user's profile Send private message
nasosan
General User
General User


Joined: 24 Jan 2008
Posts: 23
Location: carcare, savona, italia

PostPosted: Sun Aug 01, 2010 2:12 am    Post subject: Reply with quote

floris_v wrote:
Well, you can start a new document, paste in the selection there, then export the new doc to PDF. It's a bit roundabout, but who cares about that if it works?

i have try it.. but the selection is build whit a link to other cell on other sheet.. when i paste into new doc, the value of cell is lost...
_________________
http://www.nasosan.it
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
nasosan
General User
General User


Joined: 24 Jan 2008
Posts: 23
Location: carcare, savona, italia

PostPosted: Sun Aug 01, 2010 2:15 am    Post subject: Reply with quote

hanya wrote:
nasosan wrote:
hi dont want to export a sheet.. but a selection...

http://www.oooforum.org/forum/viewtopic.phtml?p=385443#385443


it's works.. Very Happy

thanks

i have lost basic=macro of OO....
bye..
_________________
http://www.nasosan.it
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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