Exemple #1
0
 def substitute(self, uri_tail, src_pkg_path, tgt_pkg_path, new_pkg_path):
     """
     Substitute the package item identified by *uri_tail* from the package
     at *src_pkg_path* into the package at *tgt_pkg_path* and save the
     resulting package at *new_pkg_path*. This can be handy for
     identifying which package item(s) in the source package are causing a
     "repair needed" error when loading the target package in MS Office.
     """
     package_1 = Package.read(src_pkg_path)
     package_2 = Package.read(tgt_pkg_path)
     pkg_item = package_1.find_item_by_uri_tail(uri_tail)
     package_2.substitute_item(pkg_item)
     package_2.save(new_pkg_path)
     OpcView.substitute(pkg_item.uri, src_pkg_path, tgt_pkg_path,
                        new_pkg_path)
Exemple #2
0
 def substitute(self, uri_tail, src_pkg_path, tgt_pkg_path, new_pkg_path):
     """
     Substitute the package item identified by *uri_tail* from the package
     at *src_pkg_path* into the package at *tgt_pkg_path* and save the
     resulting package at *new_pkg_path*. This can be handy for
     identifying which package item(s) in the source package are causing a
     "repair needed" error when loading the target package in MS Office.
     """
     package_1 = Package.read(src_pkg_path)
     package_2 = Package.read(tgt_pkg_path)
     pkg_item = package_1.find_item_by_uri_tail(uri_tail)
     package_2.substitute_item(pkg_item)
     package_2.save(new_pkg_path)
     OpcView.substitute(pkg_item.uri, src_pkg_path, tgt_pkg_path,
                        new_pkg_path)