Title. I currently can convert the entire file to a PDF, but there is no separation of sheets. Is there a macro that can achieve this?
Have you set any print range (Format - Print Ranges - Define)? At least some? For one sheet, for selected sheets? Have you disabled Format - Page - Header - Header on? You don’t want to do this with your hands, but you want the macro to do it?
I need to do this headless as it’s being run as a on demand background process in a server. I can export the entire file as a pdf with the --convert-to pdf flag, but I need to have some way to separate the pdf into different sections.
To answer your questions:
- Print Ranges: I would assume the
default print range is the entire
sheet, which is what I want. I do
have a macro that scales the sheet to
fit in the width of the
which is somewhat related.
- Header: I
have no idea how to change this with
the command line interface.
Is there some way to do this via command line? From what I can tell, the only way is to use a macro.
You are right, for the described task you really need a macro. When starting the office from the command line, you will need to specify not --convert-to pdf, but the macro name. Perhaps it will be faster to implement an algorithm that will NOT reformat the original xlsx-workbook, but will fill in some ODF template with data from this workbook and upload it to PDF. The format of this resource involves simple “question-answer” communication, but discussing your task may require a lengthy discussion. Therefore, it makes sense to ask your question in any of the specialized forums
Could there be a simpler macro to split an existing calc/excel file into separate files for each sheet?
Do you mean something like this?
oSheets = oDoc.getSheets() oEnum = oSheets.createEnumeration() Do While oEnum.hasMoreElements() NextSheet = oEnum.nextElement() ... Do something - store As New Spreadsheet, set Print Range, etc. Loop
Why not? But once more - we cannot completely discuss this project here