I need to convert bunch of powerpoint files into xml
format.
I have to change the all fonts in about 100 powerpoint files, without opening the files. There are several shape types in each slide and each might have a different font. I used python-pptx
package and wrote the some code to change the fonts of all texts in a powerpoint presentation. But, it turned out that it does not work for all languages (see change all fonts in powerpoint without opening the file for more details).
I saved the powerpoint file as xml and then changed all fonts in there. Then, when I open the file with powerpoint it works OK, all fonts are changed!. Now, I am trying to save all those powerpoint files as .xml
using a python code.
I seared to see if python-pptx
provides such a functionality or not, and I could not find anything.
============================= update===
I used opc extract
and I got:
` opc extract .\f10.pptx
usage: opc extract [-h] PKG_PATH DIRPATH
opc extract: error: the following arguments are required: DIRPATH
(base) PS C:\Users\a_oro\Downloads\pptxfile> opc extract f10.pptx .
Traceback (most recent call last):
File "c:\users\a_oro\miniconda3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\a_oro\miniconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\a_oro\Miniconda3\Scripts\opc.exe\__main__.py", line 7, in <module>
File "c:\users\a_oro\miniconda3\lib\site-packages\opcdiag\cli.py", line 304, in main
command_controller.execute(argv)
File "c:\users\a_oro\miniconda3\lib\site-packages\opcdiag\cli.py", line 53, in execute
command.execute(args, self._app_controller)
File "c:\users\a_oro\miniconda3\lib\site-packages\opcdiag\cli.py", line 228, in execute
app_controller.extract_package(args.pkg_path, args.dirpath)
File "c:\users\a_oro\miniconda3\lib\site-packages\opcdiag\controller.py", line 66, in extract_package
package.prettify_xml()
File "c:\users\a_oro\miniconda3\lib\site-packages\opcdiag\model.py", line 54, in prettify_xml
for pkg_item in self._pkg_items.itervalues():
AttributeError: 'dict' object has no attribute 'itervalues'
I appreciate any help or comment.