Example #1
0
 def buildTableTree(self, table):
     table = Table(self.doc, table)
     if table.caption is not None:
         caption = TableCaption(self.doc, table.caption, page=self.page)
         for paragraphs in hwp50.getPagedParagraphs(caption.paragraphs):
             caption.addParagraphs(paragraphs)
         table.addCaption(caption)
     for row_number, row_cells in table.getRows():
         tr = TableRow(self.doc, row_number)
         for cell in row_cells:
             cell = TableCell(self.doc, cell, page=self.page)
             for paragraphs in hwp50.getPagedParagraphs(cell.paragraphs):
                 cell.addParagraphs(paragraphs)
             tr.addCell(cell)
         table.addRow(tr)
     return table
Example #2
0
 def makeTree(self, doc):
     doc = Document(doc, destination=self.destination)
     for section in doc.sections:
         section = Section(doc, section)
         for page_paragraphs in hwp50.getPagedParagraphs(section.paragraphs):
             page = Page(doc, section.sectionDef.pages[0])
             page.addParagraphs(page_paragraphs)
             section.addPage(page)
         for html in section.etree():
             doc.body.append(html)
     return doc.etree()
Example #3
0
    def etree(self):
        if len(self.footnotes) > 0:
            if self.footnotes_view is None:
                self.footnotes_view = FootNotes(self.doc, None, page=self)
                for html in self.footnotes_view.etree():
                    self.html.append(html)
            for fn in self.footnotes:
                for fn_paragraphs in hwp50.getPagedParagraphs(fn.listhead.paragraphs):
                    self.footnotes_view.addParagraphs(fn_paragraphs)
            self.footnotes = []

        if len(self.html) == 0 and (self.html.text == None or len(self.html.text) == 0):
            self.html.text = u'\xa0'
        return self.paper.etree()