作者:乔山办公网日期:
返回目录:office365
不知道。。百。。。。。。。。。。。。。。。。。。。。。。。。。。。度。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。内。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。容。。。。。。。。。。。。。。。。。。。。。。。。。。。。
1、找到需要转换为word文档的xml文档。
2、选择文档并点击鼠标右键,选择“打开方式”栏目中的“WPS表格”(或者excel表格),点击确定按钮。
3、点击后即抄可使用表格文件开启xml格式的文件了。
4、再将表格文件进行转换zhidao操作,点击“文件”中的“另存为”。
5、选好保存路径,并点击选择文件类型为网页(*.htm; *.html)后点击确定按钮。
6、然后开启word文档或者WPS文档,点击“文件”中的“打开”选取保存为网页的文件即可实现转换操作。
如果原始文件格式中XML,那用WORD打开后“另存”,选择“格式”为 “microsoft word 文档”即可
通过jodconveter来实现转化。通过启动OpenOffice.org的服务端口,实现程e79fa5e98193e58685e5aeb9365序操作opeanoffice实现文件的转换。
贴上代码:
mport java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import com.artofsolving.jodconverter.DefaultDocumentFormatRegistry;
import com.artofsolving.jodconverter.DocumentConverter;
import com.artofsolving.jodconverter.DocumentFormatRegistry;
import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;
public class test {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
test t = new test();
//File in = new File("d:\\mytest\\test1.pdf");
//File out = new File("d:\\mytest\\test11.html");
FileInputStream input = new FileInputStream("d:\\mytest\\test11.pdf");
FileOutputStream output = new FileOutputStream("d:\\mytest\\test11.doc");
t.convert(input, output);
}
public void convert(File input, File output) throws Exception
{
OpenOfficeConnection conn = new SocketOpenOfficeConnection("localhost", 8100);
conn.connect();
DocumentConverter converter = new OpenOfficeDocumentConverter(conn);
converter.convert(input, output);
conn.disconnect();
}
public void convert(InputStream input, OutputStream output) throws Exception
{
OpenOfficeConnection conn = new SocketOpenOfficeConnection("localhost", 8100);
conn.connect();
DocumentConverter converter = new OpenOfficeDocumentConverter(conn);
DocumentFormatRegistry registry = new DefaultDocumentFormatRegistry();
converter.convert(input, registry.getFormatByFileExtension("pdf"), output, registry.getFormatByFileExtension("doc"));
conn.disconnect();
}
}