Hi,
I have a small project with macros.
It is something I’m sure I could have done with mso, and I want to know if it is possible with OO before trying :-).
The overall idea:
- in a spreadsheet, I fill fields with values picked in lists
- the macro read the values, create a new presentation file, and depending on the chosen values, insert images stored in a folder on my computer.
Questions:
- is it possible to create (or at least manipulate) a presentation file from the spreadsheet app ?
- is it possible to get a png or jpg file from the file system and insert it in the newly created presentation ?
- what are the methods to be used to manage this ?
I checked the help pages related to macros but did not found this.
Thanks !
Hello @arcqus
We need some time to check it out. I will update this thread when we have something to share.
Unfortunately, there’s no way to achieve described scenario via macros. But probably you can achieve it via DocBuilder. It seems that scenario should look like this:
- Open a xlsx file in the DocBuilder and get the data from file
- Based on the received data, determine which image should be inserted into pptx file.
The point of this step that link to image is already somewhere in the file.
- Use GlobalVariable method to pass a link between xlsx and pptx files
- Use received link with Api.CreateImage method in pptx file.
Links for reference:
https://api.onlyoffice.com/docbuilder/howitworks/globalvariable
https://api.onlyoffice.com/docbuilder/formapi
https://api.onlyoffice.com/docbuilder/spreadsheetapi/apirange/getvalue
https://api.onlyoffice.com/docbuilder/textdocumentapi/api/createimage
One more thing. Unfortunately, there’s no method to retrieve image from local storage, but the CreateImage method supports internet URLs only.
Hi Alexandre.
Thank for this thorough answer.
I’ll check or otherwise I’ll try to do something else (ex : generate html code in the spreadsheet from the chosen values).