0
我的目標是使用rtf模板創建公開,並使用自定義屬性填充變量。對於這個我使用jRTF和groovy編程。jRTF無法將模板寫入文件
在文檔中,你可以看到輸出與該代碼執行:
Rtf.template(new FileInputStream("template.rtf))
.inject("ADDRESSLINE1", "tutego")
.inject("ADDRESSLINE2", bold("Sonsbeck"))
.out(FileOutputStream("out.rtf"));
不幸的是,這並不爲我工作。我的代碼如下所示:
def createExpose() {
def template = Rtf.template(new FileInputStream("C:\\template.rtf")).inject("PERSON", "John Smith")
.inject("BIRTHDATE", "1992")
.inject("LOCATION", "Milky Way")
.inject("CITIZENSHIP", "Mars").out(FileOutputStream("out.rtf"))
def response = template
return response
}
它的工作原理,如果我只是使用了()不帶參數,但我只得到字節串仍然需要被轉換爲RTF文件。任何人有想法?
謝謝