Output report to word docx

def outputWord(self):
        """Output report to word docx
        """
        import docx
        from docx.enum.text import WD_ALIGN_PARAGRAPH
        
        doc = docx.Document()
        doc.styles['Normal'].paragraph_format.alignment = WD_ALIGN_PARAGRAPH.JUSTIFY
        
        doc.add_heading(self.title, level=0)
        if self.addTime:
            from time import localtime, strftime
            doc.add_heading(strftime("%Y-%m-%d %H:%M:%S", localtime()), level=1)
            
         # Append introduction
        if self.p:
            doc.add_heading('Introduction',level=1)
            for p in renewliner(self.p).split('\n'):
                doc.add_paragraph(p)

        # Sections
        c = count(1)
        #Prepare fig and table numbers
        self.listFigures(tuple())
        self.listTables(tuple())
        for section in self.sections:
            section.sectionsWord((next(c),),doc=doc)

        # Append conclusion
        if self.conclusion:
            doc.add_heading('Conclusion', level=1)
            for p in renewliner(self.conclusion).split('\n'):
                doc.add_paragraph(p)

        # Generate Word document
        doc.save(self.outfile+'.docx')