Code to print two copies from selected sheet

Creating a macro - Writing a Script - Using the API

Code to print two copies from selected sheet

Postby Otapi » Thu Mar 20, 2008 10:56 am

Im using openoffice calc and I've got this code

Code: Select all   Expand viewCollapse view
oDoc = ThisComponent
Dim Props(0) As New com.sun.star.beans.PropertyValue
Props(0).Name = "CopyCount" : Props(0).Value = 2
Props(0).Name = "Sort" : Props(0).Value = True
ThisComponent.Print(Props())


At the moment it does nothing but prints all sheets that have something written on them, but what it should do is that it should print only selected sheets twice (also know as "make a copy of them"). So if there is any code or anything that you can assist me with i would be very grateful, thanks.

EDIT: I have even checked all the pring range topics but all they do is tell me how can print sheets from X to Z and not how i can print those sheets that i have selected.
Otapi
 
Posts: 13
Joined: Thu Mar 13, 2008 10:43 am

Re: Code to print two copies from selected sheet

Postby uros » Sun Mar 23, 2008 10:43 pm

Hi Otapi!
Check Tools > Options > OpenOffice.org Calc > Print > Print selected sheets only
Hope it helps!
Uros
User avatar
uros
Volunteer
 
Posts: 30
Joined: Sun Dec 02, 2007 10:26 pm
Location: Slovenia

Re: Code to print two copies from selected sheet

Postby Otapi » Tue Mar 25, 2008 11:37 am

Unfortunately it must not go that way, my employer wants the button to do all the work so that they don't have to touch options or anything at all.
Otapi
 
Posts: 13
Joined: Thu Mar 13, 2008 10:43 am

Re: Code to print two copies from selected sheet

Postby Otapi » Tue Mar 25, 2008 3:40 pm

Hey, i changed the code but it still does not work the way it should...

The new code is
Code: Select all   Expand viewCollapse view
Dim oPropertyValue(0) as New com.sun.star.beans.PropertyValue
oDoc = ThisComponent
oPropertyValue(0).Name = "Print only selected sheets" : oPropertyValue(0).Value = True
oDoc.Print(oPropertyValue())


...But it still prints all sheets that have text on them were they selected or not

So umm, what kind of code or properties i need to make it work?
Otapi
 
Posts: 13
Joined: Thu Mar 13, 2008 10:43 am


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests