Page 1 of 1

[Solved] Print multiple copies dBase

Posted: Sat Jan 20, 2018 9:39 pm
by christos73
Hello,

I've installed Invoice_Forms_v2.odb from:
[Example] Invoice Forms (without macros)

and i need to print 2 copies each time when i print. But without using the printer options (number of copies).

Thanks and bye!

Re: Print multiple copies dBase

Posted: Sat Jan 20, 2018 11:35 pm
by Villeroy
print 2 copies of what?

Re: Print multiple copies dBase

Posted: Sat Jan 20, 2018 11:41 pm
by christos73
to be printed 2 times the same page.

maybe with macro(CopyCount) ?

Re: Print multiple copies dBase

Posted: Sat Jan 20, 2018 11:48 pm
by Villeroy
I don't know any macro "CopyCount". 2 times which page? What is a "page" in the database you have linked?

Re: Print multiple copies dBase

Posted: Sat Jan 20, 2018 11:52 pm
by christos73
I want to make a button in calc so when i press it 'll print my sheet 2 times without doing it manually from Print 'Number of copies"
Forcing it to print 2 copies with one click.

Re: Print multiple copies dBase

Posted: Sun Jan 21, 2018 12:01 am
by Villeroy
Import the record set in question 2 times into Calc.

Re: Print multiple copies dBase

Posted: Sun Jan 21, 2018 12:38 am
by UnklDonald418
Chapter 13 of Andrew Pitonyak's book “OpenOffice.org Macros Explained” includes a discussion of writing macro code to print Writer documents as well as Calc documents.
Chapter 5 of his download “Useful Macro Information” has a section named “Print Current Document”
both can be downloaded from
http://www.pitonyak.org/oo.php
You should also be aware that a Base form is actually a Writer document.

Re: Print multiple copies dBase

Posted: Sun Jan 21, 2018 1:01 am
by christos73
Found it.

Code: Select all

REM  *****  BASIC  *****
Sub printDocOnce
   DIM oDoc   
   oDoc = ThisComponent

   REM Set backgroundImage-option to False
   DIM oSettings
   oSettings = oDoc.createInstance("com.sun.star.text.DocumentSettings")
  rem oSettings.PrintPageBackground = False

   REM Set printOptions
   DIM mPrintOpts(2) AS NEW com.sun.star.beans.PropertyValue
   mPrintOpts(0).Name = "CopyCount"
   mPrintOpts(0).Value = 1
   mPrintOpts(1).Name = "Collate"
   mPrintOpts(1).Value = True

   REM Print
   oDoc.Print(mPrintOpts())

   REM Set backgroundImage-option back to True
   rem oSettings.PrintPageBackground = True
   REM Do a 0-print to set the option   
   DIM mPrintOpts2(0) AS NEW com.sun.star.beans.PropertyValue
   mPrintOpts2(0).Name = "CopyCount"
   mPrintOpts2(0).Value = 0
   oDoc.Print(mPrintOpts2())
End Sub
Import the record set? how?