[Solved] Print multiple copies dBase

Discuss the database features
Post Reply
christos73
Posts: 16
Joined: Sat Jan 20, 2018 4:26 pm
Location: Greece

[Solved] Print multiple copies dBase

Post 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!
Last edited by christos73 on Sun Jan 21, 2018 9:00 pm, edited 2 times in total.
Apache OpenOffice 4.1.7 - -
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Print multiple copies dBase

Post by Villeroy »

print 2 copies of what?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
christos73
Posts: 16
Joined: Sat Jan 20, 2018 4:26 pm
Location: Greece

Re: Print multiple copies dBase

Post by christos73 »

to be printed 2 times the same page.

maybe with macro(CopyCount) ?
Apache OpenOffice 4.1.7 - -
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Print multiple copies dBase

Post by Villeroy »

I don't know any macro "CopyCount". 2 times which page? What is a "page" in the database you have linked?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
christos73
Posts: 16
Joined: Sat Jan 20, 2018 4:26 pm
Location: Greece

Re: Print multiple copies dBase

Post 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.
Apache OpenOffice 4.1.7 - -
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Print multiple copies dBase

Post by Villeroy »

Import the record set in question 2 times into Calc.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
UnklDonald418
Volunteer
Posts: 1548
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Print multiple copies dBase

Post 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.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
christos73
Posts: 16
Joined: Sat Jan 20, 2018 4:26 pm
Location: Greece

Re: Print multiple copies dBase

Post 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?
Apache OpenOffice 4.1.7 - -
Post Reply