[Solved] Print Calc sheet to PDF, using a macro
[Solved] Print Calc sheet to PDF, using a macro
How to make a macro that exports a specific spreadsheet to PDF, considering the print area already defined in LibreOffice Calc?
Last edited by MrProgrammer on Mon Jul 15, 2024 5:16 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
LibreOffice 6.2.8.2 (x64), Windows 10 Home
- MrProgrammer
- Moderator
- Posts: 5373
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Print a specific sheet of Calc as a PDF file, using a macro
Please search first before posting. I found this in a few seconds. I do not offer to help further with writing macros.
[Solved] Save PrintRange as PDF to Desktop of Any User
If this solved your problem please go to your first post use the Edit ☐ button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
Re: Print a specific sheet of Calc as a PDF file, using a macro
Thank you!
LibreOffice 6.2.8.2 (x64), Windows 10 Home
Re: Print a specific sheet of Calc as a PDF file, using a macro
The "Print" method can use a virtual PDF printer (if it is exist).
Ther "Export" method uses the built-in export feature
You you can use the "Export the Selection" option. Of course you must SELECT the cell range to export (by the macro) before you use that option.
Where the oRange is a cell range object (you must get an Select it by your macro), and the Pdf_Local_URL is the place where you want to save the pdf file to.
Ther "Export" method uses the built-in export feature
You you can use the "Export the Selection" option. Of course you must SELECT the cell range to export (by the macro) before you use that option.
Code: Select all
Arg(0).Name = "Selection"
Arg(0).Value = oRange
args2(0).Name = "FilterName"
args2(0).Value = "calc_pdf_Export"
args2(1).Name = "FilterData"
args2(1).Value = Arg()
ThisComponent.storeToURL(Pdf_Local_URL, args2())
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.