Merge pull request #124 from isaacsucn/master
Insert exist document as subdocument
This commit is contained in:
commit
76345f454f
@ -199,8 +199,8 @@ class DocxTemplate(object):
|
|||||||
etree.SubElement(tblGrid, ns+'gridCol', {ns+'w': str(int(new_average))})
|
etree.SubElement(tblGrid, ns+'gridCol', {ns+'w': str(int(new_average))})
|
||||||
return tree
|
return tree
|
||||||
|
|
||||||
def new_subdoc(self):
|
def new_subdoc(self,docpath=None):
|
||||||
return Subdoc(self)
|
return Subdoc(self,docpath)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_file_crc(filename):
|
def get_file_crc(filename):
|
||||||
@ -349,10 +349,10 @@ class DocxTemplate(object):
|
|||||||
|
|
||||||
class Subdoc(object):
|
class Subdoc(object):
|
||||||
""" Class for subdocument to insert into master document """
|
""" Class for subdocument to insert into master document """
|
||||||
def __init__(self, tpl):
|
def __init__(self, tpl,docpath=None):
|
||||||
self.tpl = tpl
|
self.tpl = tpl
|
||||||
self.docx = tpl.get_docx()
|
self.docx = tpl.get_docx()
|
||||||
self.subdocx = Document()
|
self.subdocx = Document(docpath)
|
||||||
self.subdocx._part = self.docx._part
|
self.subdocx._part = self.docx._part
|
||||||
|
|
||||||
def __getattr__(self, name) :
|
def __getattr__(self, name) :
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user