package Word2DitaTest;
import org.dita.dost.Processor;
import org.dita.dost.ProcessorFactory;
import org.dita.dost.exception.DITAOTException;
import java.io.File;
public class Word2Dita {
public static void main(String[] args) throws DITAOTException{
final File ditaDir = new File("D:/DITA-OT/dita-ot-3.6");
final File tempDir = new File("D:/DITA-OT/dita-ot-3.6/temp");
final File outDir = new File("D:/DITA-OT/dita-ot-3.6/out");
final File mapFile = new File("D:/DITA-OT/dita-ot-3.6/dummy.xml");
final String docxFile = "D:/My_Documents/Temp/test.docx";
// Create a reusable processor factory with DITA-OT base directory
ProcessorFactory pf = ProcessorFactory.newInstance(ditaDir);
// and set the temporary directory
pf.setBaseTempDir(tempDir);
// Create a processor using the factory and configure the processor
Processor p = pf.newProcessor("word2dita")
.setInput(mapFile)
.setOutputDir(outDir)
.setProperty("nav-toc", "partial")
.setProperty("word.doc", docxFile);
// Run conversion
p.run();
}
}
该程序的输入文件,日志文件和输出文件已附加。
Hope this helps your development.
--
/*----------------------------------------------------------------------------------