python-openxml / opc-diag Goto Github PK
View Code? Open in Web Editor NEWCommand-line tool for exploring and diagnosing problems with Microsoft Office Open XML files (.docx, .pptx, .xlsx)
License: MIT License
Command-line tool for exploring and diagnosing problems with Microsoft Office Open XML files (.docx, .pptx, .xlsx)
License: MIT License
Hi,
Python 3 compatibility is in develop branch for some time, can you cut a formal release?
Thank you for your work.
I have a repaired powerpoint file where the repair apparently consisted in removing a .xml.rel file. When trying to diff the problematic and the repaired file, opc fails with the following exception:
KeyError: "No item with name 'ppt/slideLayouts/_rels/slideLayout2.xml.rels'"
The file exists in the first file, but not in the second
Any reason for the empty lines between the ---
, +++
, and @@
?
$ ./opc-stub diff /tmp/1 /tmp/2
--- /tmp/1/[Content_Types].xml
+++ /tmp/2/[Content_Types].xml
@@ -1,9 +1,9 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
- <Default ContentType="application/vnd.openxmlformats-officedocument.presentationml.printerSettings" Extension="bin"/>
- <Default ContentType="application/vnd.openxmlformats-package.relationships+xml" Extension="rels"/>
- <Default ContentType="application/xml" Extension="xml"/>
- <Default ContentType="image/jpeg" Extension="jpeg"/>
+ <Default Extension="bin" ContentType="application/vnd.openxmlformats-officedocument.presentationml.printerSettings"/>
+ <Default Extension="jpeg" ContentType="image/jpeg"/>
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
+ <Default Extension="xml" ContentType="application/xml"/>
<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
<Override PartName="/ppt/presProps.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presProps+xml"/>
--- /tmp/1/ppt/presentation.xml
+++ /tmp/2/ppt/presentation.xml
@@ -10,8 +10,8 @@
<p:sldMasterId id="2147483648" r:id="rId1"/>
</p:sldMasterIdLst>
<p:sldIdLst>
- <p:sldId id="256" r:id="rId7"/>
- <p:sldId id="257" r:id="rId8"/>
+ <p:sldId r:id="rId7" id="256"/>
+ <p:sldId r:id="rId8" id="257"/>
</p:sldIdLst>
<p:sldSz cx="9144000" cy="6858000" type="screen4x3"/>
<p:notesSz cx="6858000" cy="9144000"/>
I usually see diffs like the following with no empty lines.
diff --git a/opcdiag/view.py b/opcdiag/view.py
index 871f916..b03bd22 100644
--- a/opcdiag/view.py
+++ b/opcdiag/view.py
@@ -20,9 +20,7 @@ def _write(text):
"""
Write *text* to stdout
"""
- if sys.version_info[0] == 2:
- text = text.encode('utf-8')
- print(text, end='', file=sys.stdout)
+ sys.stdout.write(text)
Command used:
opc diff file1 file2 > diff.out
Traceback (most recent call last):
File "/usr/local/bin/opc", line 9, in <module>
load_entry_point('opc-diag==0.9.7', 'console_scripts', 'opc')()
File "/Library/Python/2.7/site-packages/opcdiag/cli.py", line 309, in main
command_controller.execute(argv)
File "/Library/Python/2.7/site-packages/opcdiag/cli.py", line 58, in execute
command.execute(args, self._app_controller)
File "/Library/Python/2.7/site-packages/opcdiag/cli.py", line 153, in execute
app_controller.diff_pkg(args.pkg_1_path, args.pkg_2_path)
File "/Library/Python/2.7/site-packages/opcdiag/controller.py", line 63, in diff_pkg
OpcView.package_diff(content_types_diff, rels_diffs, xml_part_diffs)
File "/Library/Python/2.7/site-packages/opcdiag/view.py", line 51, in package_diff
_write(text)
File "/Library/Python/2.7/site-packages/opcdiag/view.py", line 23, in _write
print(text, end='', file=sys.stdout)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2039' in position 4219: ordinal not in range(128)
I am making a program with GUI.
This GUI program comprised some functions which are load a ppt file, drag and drop a picture and paste the picture in the ppt file.
Already, I have completed the program and published to my team members as a form of exe file.
This program is working well in my computer, but not working in other member's PC.
Error type very varies and occurs when loading the ppt, dropping the picture and saving the file.
Until now, I collected two error message.
Each line in error messages are as follows
I cannot find what is the problem.
please someone help me..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.