Apache OpenOffice (AOO) Bugzilla – Issue 117783
Printer properties ignored from macros
Last modified: 2017-05-20 10:32:10 UTC
This macro prints a Write document. The document should print two pages per sheet in Landscape mode. The document prints normally. Note that this is a regression issue. Sub PrintTwoPerPage Dim Props(0 To 1) As New com.sun.star.beans.PropertyValue Props(0).Name = "PageColumns" : Props(0).Value = 2 Props(1).Name = "IsLandscape" : Props(1).Value = True If HasUnoInterfaces(ThisComponent, "com.sun.star.text.XPagePrintable") Then ThisComponent.setPagePrintSettings(Props()) ' ThisComponent.printPages(Array()) 'Use default properties Else Print "Sorry, this document does not support the XPagePrintable interface" End If End Sub Does the macro look familiar? The macro worked when this bug was fixed five years ago! http://openoffice.org/bugzilla/show_bug.cgi?id=23411 Note that I also tried this variant Sub PrintTwoPerPage_second_try Dim Props Props = ThisComponent.getPagePrintSettings() For i = 0 To UBound(Props) If props(i).Name = "PageColumns" Then props(i).value = 2 ElseIf props(i).Name = "IsLandscape" Then props(i).value = True End If Next ThisComponent.setPagePrintSettings(Props()) ThisComponent.printPages(Array()) End Sub In the deep dark recess of my mind, I keep thinking that Philipp Lohmann is aware of this problem and may even be working on it.
Side note: I also tested against 3.4 alpha. I took a look at sw/source/ui/uno/unotxdoc.cxx and it looks like this modifies this structure then puts it back. const SwPagePreViewPrtData* pData = pDocShell->GetDoc()->GetPreViewPrtData(); At that point, I stopped tracing the code.
,
@ hi: Please have a look.
@od: I think this might have broken with the print changes in 3.3 in writer, could you please have a look ?
adding keyword "regression"
Just a question: I don't get from the description since when this problem exists; I had a look at the code and from what I saw it is not surprising that the macro doesn't work: the settings are just ignored. I browsed the source code of 3.2 and couldn't spot any important difference in that area; so before I dive deeper into that, I would like to know: which is the last OOo version that is known to execute the macro properly?
the print settings are ignored since the introduction of the new printing. a fix for this issue is available and will be committed soon.
fixed in cws sw34bf06 - changed files: sw/inc/unotxdoc.hxx, sw/source/ui/uno/unotxdoc.cxx, sfx2/source/view/viewprn.cxx, vcl/inc/vcl/print.hxx, vcl/source/gdi/print3.cxx, vcl/source/window/printdlg.cxx, change set http://hg.services.openoffice.org/cws/sw34bf06/rev/766a0b3ad79f od->pl/mba: one of you, please review the fix
forgot to adjust the issue status
Reviewed, ok for me
Reviewed, looks OK for me too. Though checking only the first three characters of a parameter name looks a bid hackish.
mba, you asked when this last worked..... I last tested with working code in late 1.x or early 2.x versions. Note that the original report claims that it worked five years ago. Some items stopped working (I believe) when the new print dialog was introduced, but, I don't remember if that was this particular code.
Thanks Andrew; as Oliver already fixed the issue, we don't need to know more about that.
getting rid of value "enhancement" for field "severity". For enhancement the field "issue type" shall be used.