Apache OpenOffice (AOO) Bugzilla – Issue 110370
Duplex Option Not Saved In Document (printer settings stored in document ignored on reopening document)
Last modified: 2017-05-20 10:33:38 UTC
Our users have reported this issue and I have been able to replicate it. If you go into Calc and create a new multi-page spreadsheet and then go into File >> Printer Settings and pick a duplexing printer and select "Long Edge" this should stick in the document. However, when the document is re-opened it's back to "None". What is interesting is that this same technique in Writer works. If I create a new document in that module, set the Duplex...close and re-open the document it sticks. I'm told this worked fine in 3.1. Tested only on Linux.
.
confirmed - while the options are saved in the document (in the PrinterSetup base64binary blurp in settings.xml), those settings are ignored on reloading the document. As written: works without problem in Writer.
error can be "wordarounded" by modifying the document so that the PrinterSetup entry comes after the PrinterName setting. Apparently the error is in parsing the options / reading the printerName creates a new printer object, throwing away the one that was already created when reading the printerSetup stream.
PrinterName block clones GetOptions, but the stuff stored (and restored on loading) is the JobSetup (than then is lost when replacing the previous printer object by the one created in the PrinterName block) # printer created by cloning the options, but omitting JobSetup http://pumbaa.ooodev.org:59145/source/xref/sc/source/ui/unoobj/confuno.cxx#196 # PrinterSetup stream ends up in JobSetup http://pumbaa.ooodev.org:59145/source/xref/sfx2/source/view/printer.cxx#200 So (untested yet): replacing SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aString ); by SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aString, pPrinter->GetOrigJobSetup ); should do the trick But it probably would be better to check whether the already existing printer already has the same name.
type → PATCH
Created attachment 70637 [details] clean up whitespace mess (tab vs spaces)
Created attachment 70638 [details] the real fix - only create a new printer if the name of the existing one doesn't match the new one
Created attachment 70639 [details] translate two german comments
The reason for checking the printer name instead of copying the JobSetup is my assumption that a jobSetup of a different printer will be useless on a printer with a different name. As saving Print settings (using File|Printer settings, then saving the document) will also set the printerName property, the JobSetup's printername should always match the printername anyway. Thus PrinterName will now only trigger creation of new printer in case PrinterSetup has empty value/when no JobSetup is defined in the document.
Worked in OOo 3.1 => Set keyword "regression". Printer info gets lost on Windows, too => Set OS to "All" sba -> nn: As discussed, please have a look, thanks.
The patch looks right.
Adjusted target
Fixed in CWS "calc57".
Reassigning to QA for verification.
verified in internal build cws_calc57