Created On:  17 October 2012

Problem:

How do you launch DocFactory by using Java?

Resolution:

It is possible to launch DocFactory via Java by using the below code. Using this method will allow you to run multiple DocFactory templates. The code by can be used for either DocFactory or DocFactory2. There is one caveat, you must specify the necessary baseline within your template. This code is also attached to this article.

public class runDF {
 
 public static void main( String[] args) {
  
  
  try
  {
   String project=" /Project \"Address Book\"";
   String template=" /Template \"c:\\test.dot\"";
   String saveas=" /SaveAs \"c:\\result.doc\"";
   String Server=" /Server localhost";
   String User=" /User admin";
   String Password=" /Password admin";
   String Auto=" /Auto YES";
   
   System.out.println("running: " + "\"C:\\Program Files\\Borland\\CaliberRM\\Docfactory.exe\"" + project + template + saveas + Server + User + Password + Auto);
   String cmdline = "\"C:\\Program Files\\Borland\\CaliberRM\\Docfactory.exe\"" + project + template + saveas + Server + User + Password + Auto;
   Process process = Runtime.getRuntime().exec(cmdline);
   process.waitFor();
   System.out.println("Ended: " + process.exitValue());
   process.destroy();
   
  }
  catch(Exception Ex)
  {

  }
  

 }
}