How would one pass cell range when using export API (calc_png_Export/calc_pdf_Export)?

The equivalent option in the ui is “Selection” in the export dialog:
Screenshot 2023-03-29 at 11.15.52 am

I suspect that it should be added after calc_png_Export, similar to how one can add SinglePageSheets:

soffice --convert-to 'pdf:calc_pdf_Export:{"SinglePageSheets":{"type":"boolean","value":"true"}}' excel-file.xlsx

I do see that there is a “Selection” option in pdfexport.cxx, but I’m not sure about its format as it’s defined as type Any, and I could not locate individual XRenderable implementations that do the work. I’m not sure what the equivalent file for png export is either (svgexport.cxx perhaps?).

It’s possible that ‘Selection’ is just intended to be true/false, in which case the question is, how does one specify the “currently selected range” when making an export call? Above I called soffice directly, but I’m open to a different API (e.g. I’m testing PyOO right now).

I never do this, but if I had to, I would try something like “#Sheet7.K18:Q191” appended to the filename.
(Following the general standard of referring to internal parts.)

The selection passed to the renderer is a cell range object of the selection obtained from the current view (see source). There is no such thing from the command line. A full fledged API approach that selects a range could work.

1 Like