cybertools/docgen
2012-11-26 09:34:13 +01:00
..
testing work in progress: use MHT files for generation of Word documents 2012-11-26 09:34:13 +01:00
__init__.py work in progress: new package docgen for document generation 2012-01-27 07:51:53 +01:00
base.py generate Word document by embedding content in .mht file 2012-08-07 18:56:13 +02:00
document.mht work in progress: use MHT files for generation of Word documents 2012-11-26 09:34:13 +01:00
mht.py work in progress: use MHT files for generation of Word documents 2012-11-26 09:34:13 +01:00
README.txt work in progress: use MHT files for generation of Word documents 2012-11-26 09:34:13 +01:00
tests.py work in progress: new package docgen for document generation 2012-01-27 07:51:53 +01:00
word.css generate Word document by embedding content in .mht file 2012-08-07 18:56:13 +02:00
word_body.pt generate Word document by embedding content in .mht file 2012-08-07 18:56:13 +02:00
word_macros.pt work in progress: new package docgen for document generation 2012-01-27 07:51:53 +01:00
word_page.pt allow definition of Section elements in report instead of standard page 2012-08-04 09:23:27 +02:00

================================================================
docgen - Document Generation from Result Sets and XML Structures
================================================================

  >>> from zope import component
  >>> from zope.publisher.browser import TestRequest

  >>> from cybertools.docgen.base import WordDocument
  >>> doc = WordDocument(None, TestRequest)


Working with MHT Files
======================

  >>> import os
  >>> basePath = os.path.join(os.path.dirname(__file__), 'testing')

  >>> path = os.path.join(basePath, 'test_doc.mht')
  >>> f = open(path, 'rt')
  >>> data = f.read()
  >>> f.close()

  >>> imagePath = os.path.join(basePath, 'test_image.jpg')

  >>> from cybertools.docgen.mht import MHTFile
  >>> document = MHTFile(data)
  >>> document.addImage(imagePath)

  >>> body = '''
  ... '''

  >>> document.setBody(body)

  >>> outPath = os.path.join(basePath, 'out_doc.mht')
  >>> f = open(outPath, 'wt')
  >>> f.write(document.data)
  >>> f.close()

  >>> os.unlink(outPath)