Page 1 of 1

Code to print two copies from selected sheet

Posted: Thu Mar 20, 2008 10:56 am
by Otapi
Im using openoffice calc and I've got this code

Code: Select all

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.

Re: Code to print two copies from selected sheet

Posted: Sun Mar 23, 2008 10:43 pm
by uros
Hi Otapi!
Check Tools > Options > OpenOffice.org Calc > Print > Print selected sheets only
Hope it helps!
Uros

Re: Code to print two copies from selected sheet

Posted: Tue Mar 25, 2008 11:37 am
by Otapi
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.

Re: Code to print two copies from selected sheet

Posted: Tue Mar 25, 2008 3:40 pm
by Otapi
Hey, i changed the code but it still does not work the way it should...

The new code is

Code: Select all

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?