java io 操作写入word - Java / Web 开发
public static void main(String[] args) throws Exception {
File file = new File("D:/Tools/apache-tomcat-5.5.28/webapps/j2w/upload/word.doc");
File file1 = new File("D:/Tools/apache-tomcat-5.5.28/webapps/j2w/upload/word1.doc");
File file2 = new File("D:/Tools/apache-tomcat-5.5.28/webapps/j2w/upload/word2.doc");
if (!file1.exists()) {
file1.createNewFile();
}
if (!file2.exists()) {
file2.createNewFile();
}
InputStream in = null;
InputStream in2 = null;
OutputStream out = null;
try {
// 一次读一个字节
in = new FileInputStream(file1);
in2 = new FileInputStream(file1);
out = new FileOutputStream(file);
SequenceInputStream sis = new SequenceInputStream(in, in2);
byte[] b = new byte[1];
while ((sis.read(b)) != -1) {
out.write(b);
}
out.flush();
in.close();
out.close();
} catch (Exception e) {
e.printStackTrace();
return;
}
}
问题是这样的:
共有三个word
A.doc、B.doc、C.doc
A,B都有值。C是空的。我想把A,B的内容给C。但是明显的看到了C的文件大小的确是变大了,但是里面的内容只有A的或者是B的。
还有用追加的方式。我也试过了,还是不行。知道的老鸟顶一下,解决立刻散分
我想把A。doc,B。doc的内容写入C。doc,但是没有成功,可以看到C的文件大小明显变大,但是里面的内容不正确
相关问答:
请我用FCK上传文件,在本地的windows机上测试可以,但部署到linux服务器上就上传不了文件,上传文件时一直卡在那里。望各位大虾指点,谢谢!
路过,帮你顶一下。。。。。。。。。。。。。。
上传文件的路径问题, ......
有谁用java做过打印发票的程序,感觉这方面不是很好控制,希望给点建议,最好能给出代码
简单点就调用window.print()
你也可以把下面代码放到你JSP中:
<html>
<head>
<title> ......
我是个新手,望高手解答
我现在已经安装了mysql,也有mysql的jdbc。但我怎么配置后,才能在MyEclipse里操作mysql呢?请高手说详细点
打开Myeclipse----window---open perspective---MyEclipse database explorer-- ......
id name datetime
1 a 2010-05-13 10:15:00
2 b 2010-05-14 09:10:00
3 d 2010-05-14 10:10:00
如何将距离目前最近的那个记录的name 更新为“x”呢
谢谢咯 啊 呵呵
update table_n ......