# Append a table doc.add(table([['A1','A2','A3'],['B1','B2','B3'],['C1','C2','C3']])) doc.add(heading('Editing documents',2)) doc.add(paragraph('Thanks to the awesomeness of the lxml module, we can:')) for point in ['Search and replace','Extract plain text of document','Add and delete items anywhere within the document']: doc.add(paragraph(point,style='ListBullet')) pic_paragraph = picture(doc,'python_logo.png','This is a test description') doc.add(pic_paragraph) doc.replace('the awesomeness','the goshdarned awesomeness') # Add a pagebreak doc.add(pagebreak(type='page', orient='portrait')) doc.add(heading('Ideas? Questions? Want to contribute?',2)) doc.add(paragraph('''Email <*****@*****.**>''')) # Setting the meta properties of the document. This part is work in progress. If you create a document from scratch, you # we to set them manually. There are also WebSettings, AppProperties and ContentTypes. At the moment they are initialized # on creating a new DocxDocument. Take a look into meta.py for the various classes available. Plan is to work on those meta classes and expand their functionality to the user later on. doc.core_properties = CoreProperties( title='Creating a docx document in Python from scratch.', creator='markmywords', keywords=['python', 'MS Office', 'docx'] ) # Finally, we save the document. doc.save('Welcome to the Python docx module.docx')