Append the output and export to pdf


I am using Calc with basic - macro, which work well with pdf export.
(It is like mail merge using calc only.)

   dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args1())
Next rollno
End Sub

(This is the last few lines of the macro to export calc range as pdf.)

My macro have loop and it changes value of range and then export (the template/result sheet) to a separate pdf. (similar to mail merge but here only and only calc is doing all.)
Now I want to append all (i.e. export of n number loop) and export them to a single pdf.
I tried every possible way but nothing work (I have limited knowledge of basic - macro, I use copy - paste + change/trial and error method).

Possible solutions…

  • append cell range using insert or copy - paste method, using them as object.


  • export to a new calc sheet (or a new file) and append all exported data in it and then export it as pdf.


  • your suggestions…

Here is sample mail merge.

image description image description

YouTube: Video-0 Video-1 Video-2 Video-3 Video-4

P.S. Helpful Section

Thanks in advance,

Brijesh David

Hello, please share all your macro code for export - update your ask. I think I can modify it to copy/paste the ranges to one new sheet and export this new sheet.

Well, I derived my code from here…

You could call an external program like pdftk or ghostscript via shell() for this. Several you find in this discussion at Stackoverflow


1 Like

Thank you very much… If I will able to use any script from your link I will update here.

Under Win sometimes I used Free PDF Tools

1 Like

Yes, I installed. Really very useful.

My minimalistic version :slight_smile:

Awesome… Thank you very much Kamil L.

(Again I need some more time to understand and modify.)


I will update here when I will done with calc_only_mail_merge.