From f93df85d0386ffcca524df14619f8f4e9b570e9b Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 7 Mar 2020 05:22:36 -0800 Subject: [PATCH] Improve a bit ppt support --- libmat2/office.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libmat2/office.py b/libmat2/office.py index 1765896..d945f6a 100644 --- a/libmat2/office.py +++ b/libmat2/office.py @@ -1,3 +1,4 @@ +import uuid import logging import os import re @@ -82,7 +83,7 @@ class MSOfficeParser(ZipParser): r'^(?:word|ppt)/_rels/header[0-9]*\.xml\.rels$', r'^ppt/slideLayouts/_rels/slideLayout[0-9]+\.xml\.rels$', r'^ppt/slideLayouts/slideLayout[0-9]+\.xml$', - + r'^(?:word|ppt)/tableStyles\.xml$', # https://msdn.microsoft.com/en-us/library/dd908153(v=office.12).aspx r'^(?:word|ppt)/stylesWithEffects\.xml$', })) @@ -302,6 +303,13 @@ class MSOfficeParser(ZipParser): f.write(b'') f.write(b'') f.write(b'') + elif full_path.endswith('/ppt/tableStyles.xml'): # pragma: no cover + # This file must be present and valid, + # so we're removing as much as we can. + with open(full_path, 'wb') as f: + f.write(b'') + uid = str(uuid.uuid4()).encode('utf-8') + f.write(b'' % uid) if self.__remove_rsid(full_path) is False: return False