File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1111Provides an API for manipulating Open Packaging Convention (OPC) packages.
1212"""
1313
14+ from opc .constants import RELATIONSHIP_TYPE as RT
1415from opc .oxml import CT_Relationships
1516from opc .packuri import PACKAGE_URI
1617from opc .pkgreader import PackageReader
@@ -27,6 +28,17 @@ def __init__(self):
2728 super (OpcPackage , self ).__init__ ()
2829 self ._rels = RelationshipCollection (PACKAGE_URI .baseURI )
2930
31+ @property
32+ def main_document (self ):
33+ """
34+ Return a reference to the main document part for this package.
35+ Examples include a document part for a WordprocessingML package, a
36+ presentation part for a PresentationML package, or a workbook part
37+ for a SpreadsheetML package.
38+ """
39+ rel = self ._rels .get_rel_of_type (RT .OFFICE_DOCUMENT )
40+ return rel .target_part
41+
3042 @staticmethod
3143 def open (pkg_file ):
3244 """
You can’t perform that action at this time.
0 commit comments