|
|
Re: Converting to Docx using xtext/xtend and docx4j [message #1233716 is a reply to message #1233698] |
Mon, 20 January 2014 10:24 |
Davide G Messages: 36 Registered: October 2013 |
Member |
|
|
Uli Merkel wrote on Mon, 20 January 2014 04:51Perhaps the following code snippet to read in external files in the Generator may help:
import static extension com.google.common.io.CharStreams.*
def addIncludeFile(String filename) '''
«val File incfile = new File("..\\!includefiles\\"+filename)»
«IF incfile.exists()»
«FOR String line : new FileReader(incfile).readLines»
«line»
«ENDFOR»
«ELSE»
«addErr("Error addIncludeFile: >" +filename+"< not in !includefiles directory")»
«ENDIF»
'''
Invoked by:
«addIncludeFile("a.sampletext")»
The relative path is in most cases the directory with the eclipse.exe file.
Just tried and doesn't worked. I saved the docx using the save() method from the docx4j package, and then called the previous method to copy all the content into a string, but it didn't work.
[Updated on: Mon, 20 January 2014 10:24] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01258 seconds