Create Macro that creates new attachments


I am very new to the Atlassian JDK and I want to develop a macro for Confluence (6.14) that just creates an empty file (e.g. PowerPoint) and then attaches and displays it on the page (with the already existing macros, e.g. Office PowerPoint macro).

My Ideas were to add a blank PowerPoint to the plugin and then somehow load it to the attachments when the macro is called, or to use org.apache.poi to create the file and then attach it.

I was looking around the forums and the internet but didn’t find any good answers to the following questions:

  1. Which way is better for creating empty files? Is there another solution that would be simpler or more elegant?
  2. How can I add a file (created or duplicated) to the attachments? Should I do this in Java?
  3. How to insert not my own macro into the page but the macro that will display the file?

Any help is greatly appreciated.