asked on November 21, 2016
So I'm trying to save a document to a specific template but can't figure out how to specify the template. The following code is the best I have so far -- but it just saves tags and when I see the document in the repository it's labeled as having no template.
@Override public void saveDocument(Session session, String path, FileType fileType, EnumSet<EntryNameOption> tags, FileInputStream fis) throws IOException { Document theDocument = Document.create(path, tags, session); Template template = new Template("Members", session); Field field = new Field("AcctNo", session); field.setType(FieldType.STRING); FieldValueCollection fvc = new FieldValueCollection(); fvc.getTemplateFields().assignTemplate(template); fvc.add(field, "1923"); theDocument.setFields(fvc); theDocument.setExtension(fileType.name()); theDocument.getTemplate(); theDocument.writeEDoc(fis, new Long(fis.available()), fileType.mimeType); theDocument.unlock(); theDocument.save(); }
0
0