Bug 106472 - Headless printing ignores macro
Summary: Headless printing ignores macro
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Commandline
  Show dependency treegraph
 
Reported: 2017-03-10 09:41 UTC by macau
Modified: 2022-03-21 15:48 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
file with macro (24.61 KB, application/vnd.oasis.opendocument.spreadsheet-template)
2017-06-09 14:15 UTC, macau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description macau 2017-03-10 09:41:37 UTC
Description:
Macros in document wont apply when i try to print in headless mode via command line. When i open same document in graphical mode, all macro work fine in automatic mode. I tryed 4.1, 5.1.6, 5.2.3, 5.3.0 and apcahe openoffice 4.1 builds in different files and different os'ses (archlinux, centos6, ubuntu 15 lts). Security level in settings in low level.

Steps to Reproduce:
1.Create text document in writer
2.Write some macro
3.Open document via command line with property parameter
3.1 without print parameter: soffice -norestore -nofirststartwizard -nologo file.ott macro://./Standard.Module1.MakeTextStyle
3.2 with print parameter: soffice -norestore -nofirststartwizard -nologo -p file.ott macro://./Standard.Module1.MakeTextStyle

Actual Results:  
witout print parameter (-p) document opens fine, all macro applyed automatic.
with -p parameter document prints on default printer, but macro wont apply. 

Expected Results:
apply macro from document, render file and then print document via default printer.


Reproducible: Always

User Profile Reset: Yes

Additional Info:


User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0
Comment 1 Xisco Faulí 2017-03-10 10:06:46 UTC Comment hidden (obsolete)
Comment 2 macau 2017-06-09 14:15:20 UTC
Created attachment 133928 [details]
file with macro

Htis file contains some macro. If i start them via terminal emulator without print key,  all work fine: "soffice /tmp/result.ots 'macro://./Standard.Module1.BuildReport()'"
But when i do same with "-p" key, document prints on default printer but without macro:
"soffice -p /tmp/result.ots 'macro://./Standard.Module1.BuildReport()'"
Comment 3 RickyAnderson 2018-09-27 07:30:20 UTC Comment hidden (spam)
Comment 4 Buovjaga 2018-10-23 17:48:15 UTC
Repro.

Arch Linux 64-bit
Version: 6.2.0.0.alpha0+
Build ID: 9a373521d7a328197a4bf9abeb0a981b7acba896
CPU threads: 8; OS: Linux 4.18; UI render: default; VCL: gtk3_kde5; 
Locale: fi-FI (fi_FI.UTF-8); Calc: threaded
Built on 19 October 2018
Comment 5 QA Administrators 2019-10-24 02:40:25 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2021-10-24 03:43:38 UTC Comment hidden (obsolete)
Comment 7 Timur 2022-03-21 15:28:51 UTC
I'm not sure this should be a bug. I guess the same can be done with 2 commands, first macro then print. 
Mike, can you please comment.
Comment 8 Mike Kaganski 2022-03-21 15:48:39 UTC
No bug here. Macro is just another URI that gets executed among others, like in

  soffice URI1 URI2 URI3 ...

with optional modifiers like -p that modify what is done with URIs following it. For -p, the action is "for each following URI, do this: execute it, print, close, continue to the next". At the time the macro URI executes, there's no active document.

When you open the URI using default mode (editing for most file types), they are kept open, so macro would work with currently open documents when it is handled.

If you want to execute a macro and print, just add the print command to the macro itself (and possibly also close the document from there).