此代码追加到已创建的Excel文件:爪哇 - 追加到Excel文件FileOutputStream中
FileOutputStream fileOut = new FileOutputStream("c:\\Decrypted.xls");
我们能添加/修改,所以如果尚未创建和附加的,如果已经是Decrypted.xls应创建产生的?
此代码追加到已创建的Excel文件:爪哇 - 追加到Excel文件FileOutputStream中
FileOutputStream fileOut = new FileOutputStream("c:\\Decrypted.xls");
我们能添加/修改,所以如果尚未创建和附加的,如果已经是Decrypted.xls应创建产生的?
根据the Javadocs for the String-accepting constructor of FileOutputStream,rover12,如果该文件尚不存在,则创建该文件。你没有看到这种行为?
(正如其他人所提到的,一定要使用the constructor that takes the second boolean argument以便您可以指定要追加文件,如果它已经存在...)
你想要FileOutputStream(File file, boolean append)
构造函数您是否截断开关或追加。
使用构造函数:
FileOutputStream fileOut = new FileOutputStream("c:\\Decrypted.xls", true);
追加到现有的文件,如果它不存在。你的例子将覆盖现有的例子。
没有任何特定的Excel文件。那也可以编辑出来。 – uckelman 2009-11-25 19:05:21
我不知道这是什么目的?不知何故,我怀疑结果将会是一个工作的,更大的Excel文件,其中包含更多数据。 – 2009-11-25 19:11:44