我需要帮助才能使用POI库成功生成word文档,我生成了文档但有一些错误。 我正在为Office 2003生成word文档,其中包含以下类: HWPFDocument
Code Java:
StringBuilder rutaArch = new StringBuilder();
rutaArch.append(ReadParameterProperties.getParameter("rutaBaseDocGeneradosLocalEsc"));
rutaArch.append("Doc002.doc");
StringBuilder rutaTemporal = new StringBuilder();
rutaTemporal.append(System.getProperty("java.io.tmpdir"));
rutaTemporal.append(File.separator);
rutaTemporal.append("tmp.doc");
String contenido = "HELLO .................";
byte b[] = contenido.getBytes();
ByteArrayInputStream bytes = new ByteArrayInputStream(b);
POIFSFileSystem poifs = new POIFSFileSystem();
DirectoryEntry directory = poifs.getRoot();
directory.createDocument("WordDocument", bytes);
OutputStream output = new FileOutputStream(rutaArch.toString());
poifs.writeFilesystem(output);
bytes.close();
output.flush();
output.close();
File file = new File(rutaTemporal.toString());
if(file.exists()){
file.delete();
}
问题是打开生成的文档时出现以下错误: word无法启动转换器mswrd632.wpc
请帮助。