code_junkie

Parsing and generating Microsoft Office 2007 files (.docx, .xlsx, .pptx)

Nov 11th, 2011
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. from docx import *
  2. document = newdocument()
  3.  
  4. # This location is where most document content lives
  5. docbody = document.xpath('/w:document/w:body',namespaces=wordnamespaces)[0]
  6.  
  7. # Append two headings
  8. docbody.append(heading('Heading',1) )
  9. docbody.append(heading('Subheading',2))
  10. docbody.append(paragraph('Some text')
Add Comment
Please, Sign In to add comment