Java Code Examples for org.apache.poi.poifs.filesystem.POIFSFileSystem#create()

The following examples show how to use org.apache.poi.poifs.filesystem.POIFSFileSystem#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HPSFPropertiesOnlyDocument.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Write out, with any properties changes, but nothing else
 */
public void write(File newFile) throws IOException {
    POIFSFileSystem fs = POIFSFileSystem.create(newFile);
    try {
        write(fs);
        fs.writeFilesystem();
    } finally {
        fs.close();
    }
}
 
Example 2
Source File: HSSFWorkbook.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Method write - write out this workbook to a new {@link File}. Constructs
 * a new POI POIFSFileSystem, passes in the workbook binary representation and
 * writes it out. If the file exists, it will be replaced, otherwise a new one
 * will be created.
 * 
 * Note that you cannot write to the currently open File using this method.
 * If you opened your Workbook from a File, you <i>must</i> use the {@link #write()}
 * method instead!
 * 
 * @param newFile The new File you wish to write the XLS to
 *
 * @exception IOException if anything can't be written.
 * @see org.apache.poi.poifs.filesystem.POIFSFileSystem
 */
@Override
public void write(File newFile) throws IOException {
    POIFSFileSystem fs = POIFSFileSystem.create(newFile);
    try {
        write(fs);
        fs.writeFilesystem();
    } finally {
        fs.close();
    }
}