Bug Hunting Session
Bug 108691 - Hidden shape in imported XLSX shown in Print window and printed
Summary: Hidden shape in imported XLSX shown in Print window and printed
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Aron Budea
URL:
Whiteboard: interoperability target:6.2.0
Keywords:
: 116028 (view as bug list)
Depends on:
Blocks: Print XLSX
  Show dependency treegraph
 
Reported: 2017-06-22 14:11 UTC by Aron Budea
Modified: 2019-08-25 03:38 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample XLSX (8.89 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2017-06-22 14:11 UTC, Aron Budea
Details
Samples with combinations of hidden/not printed settings (25.67 KB, application/zip)
2017-06-29 00:37 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2017-06-22 14:11:08 UTC
Created attachment 134210 [details]
Sample XLSX

In the attached spreadsheet a rectangle covers most of the numbers, but is set to invisible, so it's not shown. It's not shown in Print Preview and when exported to PDF, either. So far so good.

However, it is shown in Print dialog's preview, and also appears during printing, which is bad.

I wanted to check the same with native formats, but I don't see the possibility to show/hide drawing objects in LibreOffice, the transparency of line/fill can be adjusted separately, and that displays fine in Print dialog as well.

Observed using LO 5.4beta2 & 4.0.0.3 / Windows 7.
Comment 1 Aron Budea 2017-06-22 14:18:28 UTC
The difference between the two drawing object XMLs is the extra "hidden" attribute:
<xdr:cNvPr id="2" name="Rectangle 1" hidden="1"/>
Comment 2 Aron Budea 2017-06-22 14:22:24 UTC
Bug is already in 3.3.0.
Comment 3 Xisco Faulí 2017-06-22 15:24:43 UTC
Confirmed in

Version: 6.0.0.0.alpha0+
Build ID: 08f6f9dded1b142b858c455da03319abac691655
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group
Comment 4 Aron Budea 2017-06-27 03:11:50 UTC
The situation is more complicated, there are two related elements in OOXML that affect whether the drawing object is there or not:
- attribute "hidden" of element "cNvPr" [1] that controls whether the drawing object is displayed,
- attribute "fPrintsWithSheet" of element "clientData" [2] that controls whether the drawing object is printed.

A hidden drawing object is not printed (at least not shown in the preview), but there's no mention of that in the specification.
The relevant properties for binary formats can be found in MS-ODRAW, under 2.3.4.44 Group Shape Boolean Properties (fUsefHidden, fUsefPrint, fHidden, fPrint).

In LibreOffice, as noted in [3], <drawooo:display> holds this setting, which is not part of the standard, but is similar to ODF's <draw:display> [4] for layers. As far as I could see there's no option on the UI where it can be set for shapes.

Relevant pieces of the import code:
- OOXML: shape is created here based on the imported data
  http://opengrok.libreoffice.org/xref/core/oox/source/drawingml/shape.cxx#615
- OOXML: client data is imported here
  http://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/drawingbase.cxx#118
- binary format: similar properties are read and passed further
  http://opengrok.libreoffice.org/xref/core/sc/source/filter/excel/xiescher.cxx#3527

In OOXML's case the question is, where should the two attributes with different origins be processed together?


[1] https://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.spreadsheet.nonvisualdrawingproperties(v=office.15).aspx
[2] https://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.spreadsheet.clientdata.aspx
[3] https://issues.oasis-open.org/browse/OFFICE-2125
[4] http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#attribute-draw_display
Comment 5 Aron Budea 2017-06-29 00:37:16 UTC
Created attachment 134369 [details]
Samples with combinations of hidden/not printed settings

The conceptual difference is actually an issue.
Office saves all four combination of hidden / fPrintsWithSheet settings in the file, since the two settings can be turned off/on independently. However, if the shape is hidden, the sheet displays and prints the same regardless of the other setting.

Therefore in LO not only both have to be translated to the same ODF setting ("none"), afterwards it can't be unambiguously converted back to Excel format. In that case "none" should probably be converted back to hidden and printing as the more likely combination (and hidden and not printing would get lost).
Comment 6 QA Administrators 2018-07-31 02:34:08 UTC Comment hidden (obsolete)
Comment 7 Aron Budea 2018-08-10 23:18:34 UTC
Still exists in 6.1.0.3.
Comment 8 Commit Notification 2018-09-07 12:51:19 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b38065ea941375bf4f78f13314e84f4a875545d9

tdf#108691, tdf#119639 Don't print hidden objects in XLS(X)

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Aron Budea 2018-09-08 23:59:55 UTC
The case in the description should now be fixed, for a related issue I've opened bug 119764.
Comment 10 Aron Budea 2019-08-25 03:30:57 UTC
*** Bug 116028 has been marked as a duplicate of this bug. ***