You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2004/06/25 12:17:44 UTC
DO NOT REPLY [Bug 29802] New: -
XLS Read and subsequent write fails if XLS contains Images
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29802>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=29802
XLS Read and subsequent write fails if XLS contains Images
Summary: XLS Read and subsequent write fails if XLS contains
Images
Product: POI
Version: unspecified
Platform: Other
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: HSSF
AssignedTo: poi-dev@jakarta.apache.org
ReportedBy: behr@postmail.ch
Using the Library: poi-src-2.5-final-20040302
reading a XLS-File containing Images is possible. The subsequent creation of a
XLS is possible but the file is erroneous.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public class ReadWriteWorkbook {
public static void main(String[] args) throws IOException {
String fp= File.separator;
String file = "someFile.xls";
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream
(file));
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow row = sheet.getRow(0);
if (row == null)
row = sheet.createRow(0);
HSSFCell cell = row.getCell((short) 0);
if (cell == null)
cell = row.createCell((short) 0);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellValue("a test");
// Write the output to a file
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org