Bug 99359 - Can't export the current worksheet as a PNG image
Summary: Can't export the current worksheet as a PNG image
Status: CLOSED DUPLICATE of bug 97213
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Graphics-Export
  Show dependency treegraph
 
Reported: 2016-04-17 07:03 UTC by Alex Henrie
Modified: 2017-09-11 14:24 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Henrie 2016-04-17 07:03:53 UTC
To reproduce:
1. Create two worksheets in LibreOffice Calc.
2. Add some content to both worksheets.
3. Select the second worksheet.
4. Click File > Export, type foo.png, click Save, and click OK.

The resulting file is an image of the first worksheet, when it should be an image of the second worksheet (which was selected). Checking the box to export only the currently selected cells makes no difference.

Essentially, I'm asking for PNG export to work the same as exporting a PDF of the current page.

The problem is centered around DocumentToGraphicRenderer::getCurrentPageWriter, which always returns 1 for spreadsheets regardless of which worksheet is selected. See:

https://cgit.freedesktop.org/libreoffice/core/tree/filter/source/graphic/GraphicExportFilter.cxx?id=d3bf12ecb743fc0d20e0be0c58ca359301eb705f#n105

https://cgit.freedesktop.org/libreoffice/core/tree/svtools/source/filter/DocumentToGraphicRenderer.cxx?id=d3bf12ecb743fc0d20e0be0c58ca359301eb705f#n148

I finally worked around the problem by copying and pasting cells into GIMP.
Comment 1 Xisco Faulí 2017-03-01 23:01:11 UTC Comment hidden (obsolete)
Comment 2 Alex Henrie 2017-03-02 02:26:42 UTC
LibreOffice 5.3.0.3 still has this bug.
Comment 3 Marco A.G.Pinto 2017-07-24 21:15:29 UTC
LO 5.3.4.2 still has the bug.

I have spent endless hours today trying to workaround it.
Comment 4 Eike Rathke 2017-09-11 14:23:22 UTC
(In reply to Alex Henrie from comment #0)
> Essentially, I'm asking for PNG export to work the same as exporting a PDF
> of the current page.
Actually not, because PDF export exports a series of pages of the currently selected sheet (if selected sheet was requested). You quite certainly do not want that with PNG.

> The problem is centered around
> DocumentToGraphicRenderer::getCurrentPageWriter, which always returns 1 for
> spreadsheets regardless of which worksheet is selected.

Unrelated. That's the page writer in the currently setup what-is-to-be-exported range. Your problem is rather that the "Selection only" does not lead to the currently active sheet or the current cell selection, but always the first sheet.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=a7a99a574660fc62a9514b2ed3f8ddfe8ad8540c should fix that on master. There's more ongoing work for PNG export, see bug 108317, which is the current tracker for these problems.

Other than that, for the "export current page" this is a duplicate of bug 97213.

*** This bug has been marked as a duplicate of bug 97213 ***