asked on August 29, 2014
•
Show version history
I'm using java to work with laserfiche but I don't find out how to set a template to Document when i create it.
C#
int docID = Document.Create("\\" + item.n_empregados, "DEFAULT", EntryNameOption.AutoRename, ConexaoRepositorio.Session);
DocumentInfo docinfo = (DocumentInfo)Entry.GetEntryInfo(docID, ConexaoRepositorio.Session);
docinfo.SetTemplate("EMPREGADOS");
FieldValueCollection fvc = new FieldValueCollection();
fvc.Add("IDEMPREGADOS", item.empregadosid);
fvc.Add("EMPREGADOS", item.n_empregados);
docinfo.SetFieldValues(fvc);
docinfo.Save();
In Java
public void pageCreatorWithTemplate(String caminho){
try {
Document doc = null;
Folder dirRaiz = Folder.getByPath("\\", RepositoryConnection.getInstancia());
doc = Document.create(dirRaiz, "Meu Documento Java II", EnumSet.of(EntryNameOption.AUTORENAME), RepositoryConnection.getInstancia());
Page p = Page.create(doc, 1);
p.write(new File(caminho), PagePart.IMAGE);
Template t = new Template("EMPREGADOS", RepositoryConnection.getInstancia());
System.out.println("Setando template...! " + t.getName());
doc.save();
t.save();
System.out.println("Imagem Criada...!");
RepositoryConnection.getInstancia().logOut();
} catch (Exception e) {
e.printStackTrace();
}
}
As you can see how can i link the template to the document???....In Java has no DocumentInfo
0
0