Doc Creator (doc_creator) for typo3


This extension is based on PDF Generator 2. This extension uses htmltodocx, PHPWord and SimpleHTMLDom as the converter engine. So, it is a pure php converter and should work in any OS. Because of the limited function from PHPWord, it can only convert simple html page into docx.

You can find the extension installer on TER.

example in the template Constants:

doc_creator {
  top = 18
  bottom = 20
  left = 15
  right = 15
  string_search1 = <body>
  string_replace1 = <body> <!-- DOCX Body -->
  regexp_search2 = (<a (.*?)>&larr;(.*?)</a>)
  regexp_search3 = (<a (.*?)>(.*?)</a>)
  regexp_search4 = (<a (.*?)>&lt;-(.*?)</a>)
}


example in the template Setup:

# Put current page url in the document
temp.linkDOC = TEXT
temp.linkDOC {
  stdWrap.postUserFunc = tx_doccreator->linkInDoc
  stdWrap.postUserFunc.target = _blank
}

# Put the page title if not hidden in the document
temp.title = COA
temp.title {
  10 = TEXT
  10 {
    data = field:title
    if.isFalse.field = nav_hide
    wrap = <h1>|</h1>
  }
  20 = TEXT
  20 {
    value = &nbsp;
    if.isTrue.field = nav_hide
    wrap = <h1>|</h1>
  }
}

doc_creator {
  10 = TEMPLATE
  10.template = FILE
  10.template.file = EXT:doc_creator/res/html2doc.html
  10.marks.TITLE < temp.title
  50.stdWrap.wrap = <div id="maincol"> | </div>
}


If you want to put the DOC Creator link on every page, you can add this sample in the template Setup, please change to comform with your Setup:

temp.DOCT = TEXT
temp.DOCT {
  value = docx
  postUserFunc = tx_doccreator->makeDocLink
  postUserFunc.target = _blank
  postUserFunc.no_user_int = 0
}

temp.maincol = COA
temp.maincol {
10 = CONTENT
    8 < temp.DOCT
    10 < styles.content.get
}

For detail information, please read the documentation in the extension.


Comments

Popular Posts