I'm new at using python with the LibreOffice suite. I'm basically trying to programmatically copy a base Impress file and mass copy it but changing the size of certain text boxes.
I checked some documentation online about this but was confused on how to actually achieve it.
Thank you
Edit: I wrote this test code
import os
import zipfile
import glob
import uno
def MassCreatePresentation():
file = os.path.abspath(glob.glob('INTROTEMPLATE.pptx')[0])
print('File Found')
print(file)
oDoc = XSCRIPTCONTEXT.getDocument()
return
But it shows this error:
File "MassPresentation.py", line 10, in MassCreatePresentation
oDoc = XSCRIPTCONTEXT.getDocument()
NameError: name 'XSCRIPTCONTEXT' is not defined
Edit:
Ok I finally figured this out using this logic. The way I did it:
1)get shutil to copy base file 2)use zipfile to unzip the copied pptx file, 3)navigate to the slide xml and use readlines() 4)modify the xml and save it 5)archive as zip and then rename file to .pptx 6)Celebrate