Issue 88333 - Setting PrintOptions CopyCount on mmservice doubles the amount of copies printed.
Summary: Setting PrintOptions CopyCount on mmservice doubles the amount of copies prin...
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: OOo 2.4.0
Hardware: All All
: P3 Trivial with 1 vote (vote)
Target Milestone: OOo 3.1
Assignee: joerg.skottke
QA Contact: issues@framework
: 90289 95373 96312 (view as issue list)
Depends on:
Reported: 2008-04-16 11:03 UTC by kpassey
Modified: 2010-02-12 14:25 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

an example of the bug (7.92 KB, application/vnd.oasis.opendocument.spreadsheet)
2008-05-03 00:08 UTC, ga_thrawn
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description kpassey 2008-04-16 11:03:50 UTC
I have written a small java application that calls the mmservice to print 
letters. Some letters I print should be printed as multiple copies so I pass a 
number to the java program which sets a property value "PrintOptions" with 
CopyCount set to nn. This worked fine on 2.2 - but on 2.4 the number of letters 
actually printed is doubled. Interesingly on the printer queue the number of 
pages is correct. The code is here 

This does the same on WIN2000 and XP pro and Home.
Comment 1 michael.ruess 2008-04-16 12:18:39 UTC
Reassigned to HI.
Comment 2 h.ilter 2008-04-18 12:40:19 UTC
HI->PL: Please have a look.
Comment 3 philipp.lohmann 2008-04-22 16:44:55 UTC
pl->os: mmservice is supposed to be mail merge. Since the normal copy count on
vcl's printer seems to work ok, I think this might be a mail merge problem ?
Comment 4 kpassey 2008-04-22 19:06:21 UTC
Additionally - I am setting the number of copies every time - if the number of 
copies is 1 only one is printed. If I set the value to 2 I get 4 copies 
printed. This worked perfectly on the previous release 2.2.1.
Comment 5 paolomantovani 2008-04-30 22:08:35 UTC
With the following macro I could reproduce the problem.
Instead of the expected 2 copies I got 4
OOo2.4 (Sun build) on Linux/Ubuntu 7.04 

Sub Stampa()
        Dim oDoc    as Object
        Dim oRange  as Object
        Dim oFoglio as Object
        oDoc = ThisComponent
        ofoglio = ThisComponent.CurrentController.ActiveSheet
        oRange = oFoglio.getCellRangeByName("$A$1:$E$47").getRangeAddress()
        Dim args1(2) as new    
        args1(0).Name = "CopyCount"
        args1(0).Value = 2
        args1(1).Name = "Selection"
        args1(1).Value = true
        args1(2).Name = "Collate"
        args1(2).Value = false
End Sub
Comment 6 paolomantovani 2008-04-30 22:34:12 UTC
the problem seems not specific to Writer / WinXP since I could reproduce it with
Calc on Linux, please update the issue
Comment 7 lockvogel 2008-05-02 21:41:35 UTC
We have the same problem with OOo 2.4 (OOo 2.3 works fine)!
Comment 8 ga_thrawn 2008-05-03 00:07:29 UTC
I confirm this bug too. I am having the same issue with oOo 2.4, no problem with
Comment 9 ga_thrawn 2008-05-03 00:08:49 UTC
Created attachment 53330 [details]
an example of the bug
Comment 10 Mathias_Bauer 2008-05-04 10:24:56 UTC
So this is a regression then - right?
Comment 11 Oliver Specht 2008-05-05 07:31:52 UTC
Target set to 3.0
->pl: As it occurs also in Calc I assign the issue back to you. 
Comment 12 paolomantovani 2008-05-05 23:13:58 UTC
An italian user pointed out that this problem does not occour if you print 
from the dispatcher.
This is his testing code:

Sub Prova
        Dim oDoc As Object
        Dim dispatcher As Object
        oDoc = ThisComponent.CurrentController.Frame
        dispatcher = createUnoService("")
        Dim args1(0) as new
        args1(0).Name = "PrintArea"
        args1(0).Value = "$A$1:$G$37"

        dispatcher.executeDispatch(oDoc, ".uno:ChangePrintArea", "", 0, args1

        Dim args2(1) as new
        args2(0).Name = "Copies"
        args2(0).Value = 2
        args2(1).Name = "Collate"
        args2(1).Value = true

        dispatcher.executeDispatch(oDoc, ".uno:Print", "", 0, args2())
        dispatcher.executeDispatch(oDoc, ".uno:DeletePrintArea", "", 0, 

End Sub
Comment 13 philipp.lohmann 2008-06-03 10:20:14 UTC
*** Issue 90289 has been marked as a duplicate of this issue. ***
Comment 14 pbd4499 2008-06-05 12:44:58 UTC
Please also show the solution as for full document without selection like
Comment 15 philipp.lohmann 2008-07-01 14:47:05 UTC
pl->mba: as discussed, this is due to the fact that the print dialog sets
Collate as default now. A workaround might be to set the checkbox as gotten from
the property set, but I don't know what side effect that may have.
Comment 16 Mathias_Bauer 2008-07-01 15:24:34 UTC
That seems to be perfectly OK.
Comment 17 Mathias_Bauer 2008-07-08 16:47:48 UTC
fixed in cws mba30fixes02
cws was moved to target 3.1 by mh
Comment 18 Mathias_Bauer 2008-10-07 12:54:18 UTC
please verify
Comment 19 joerg.skottke 2008-10-10 06:35:58 UTC
The sample BASIC script now prints two copies instead of four.
Comment 20 philipp.lohmann 2008-10-23 15:17:24 UTC
*** Issue 95373 has been marked as a duplicate of this issue. ***
Comment 21 Mathias_Bauer 2008-12-17 14:57:01 UTC
*** Issue 96312 has been marked as a duplicate of this issue. ***
Comment 22 joerg.skottke 2009-03-20 09:08:50 UTC
kpassey, can you please verify the issue in a OOO310m6 build?
Comment 23 kpassey 2009-03-20 16:25:34 UTC
I tried this with software installed as OOo-dev 3 which I assume is 310m6 and 
it printed 4 letters when I requested 2.
Comment 24 joerg.skottke 2009-03-25 12:45:01 UTC
Hi kpassey,

you assume? ;-)

Can you please try this on a OOO310m7 build? 
You can find the version via help->about menu if unsure.

Comment 25 kpassey 2009-03-25 12:48:27 UTC
Yes I will do it today...

And it was 3106 - thanks for your help.

Comment 26 kpassey 2009-03-25 16:46:47 UTC
Just downloaded latest developer build 3107m and It still prints 4 copies when 
I pass 2..

Thanks anyway..let me know when the next one is available as I have this set to 
run as soon as I can download a newer release.

Comment 27 joerg.skottke 2009-04-23 13:11:36 UTC
Ok, so the result is the same for both of us. Failed, back to new.
I change the target to 3.2 :-(
Comment 28 joerg.skottke 2009-04-23 13:12:24 UTC
To mba
Comment 29 Mathias_Bauer 2009-05-11 10:22:59 UTC
I've used the macro in #desc6 for testing with the released 3.1 version - I got
two copies as expected.
In case you get 4 copies with a macro, please attach the test code.
Comment 30 Mathias_Bauer 2009-05-11 10:23:24 UTC
Please verify
Comment 31 kpassey 2009-05-13 16:47:28 UTC
I still get four copies using java - not macro..

This was working perfectly on previous versions.

Comment 32 Mathias_Bauer 2009-05-13 18:32:31 UTC
I followed the link you posted in your initial desription but it seems to
contain only incomplete code. Could you post the complete section of the code
that actually executes the printing call? Please have a look at the macro code
snippets here, perhaps this helps you to spot a difference.
Comment 33 kpassey 2009-05-14 12:45:52 UTC
I only had CopyCount as a single print option - when I add collate it prints the
correct amount of copies - are these two options dependant - or is there still a
less outstanding bug in there.
Comment 34 Mathias_Bauer 2009-05-14 14:00:58 UTC
Indeed these options should be independent. 
*Should*. :-)
As we handle collating ourselves (as not all printer drivers do it correctly),
we have to set the "internal" copy count from "n" to "1" and print n times.
Unfortunately setting the count and doing the loop happens at two places. And
the code setting the count still thinks that "Collate" has the default value
It seems that whoever has changed the default of "Collate" to "true" some time
ago, forgot to change it at that place also.
So now the code works if "Collate" is set explicitly (to which value ever), but
not if it is not set.
Thanks for helping to find that out. As a workaround, you can set "Collate" to
"True" (the default value) in your code and then it should work. 
Comment 35 kpassey 2009-05-14 14:55:11 UTC
I've set collate and it now works fine. Happy to have been assistance.
Comment 36 Mathias_Bauer 2009-05-14 15:26:44 UTC
Thanks for the confirmation. I already fixed the problem by setting the proper
default in sfx2/source/view/viewprn.cxx.

Fixed in CWS mba32issues02
Comment 37 kpassey 2010-02-10 15:09:09 UTC
This was fixed in 3.1.0 - it appears an install from 2.4.1 to 3.1.1 has broken it.

If I upgrade from 3.1.0 then it still works but a 3.1.1 install over 2.4.1 does
not incorporate the updates. Still testing!!
Comment 38 kpassey 2010-02-11 12:57:12 UTC
Please close this off again - further testing has highlighted problems with my java. Sorry for the inconvenience.
Comment 39 kpassey 2010-02-11 12:57:25 UTC
Please close this off again - further testing has highlighted problems with my java. Sorry for the inconvenience.
Comment 40 Marcus 2010-02-12 14:24:21 UTC
Comment 41 Marcus 2010-02-12 14:25:04 UTC
closing again