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 2011/08/02 18:06:59 UTC
DO NOT REPLY [Bug 51601] New: Excel 2003 and 2007 can not open file
generated by poi if the number of sheet in a workbook exceed 1370 sheets
https://issues.apache.org/bugzilla/show_bug.cgi?id=51601
Bug #: 51601
Summary: Excel 2003 and 2007 can not open file generated by poi
if the number of sheet in a workbook exceed 1370
sheets
Product: POI
Version: 3.7
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
AssignedTo: dev@poi.apache.org
ReportedBy: felix@sanchezit.com
Classification: Unclassified
Created attachment 27341
--> https://issues.apache.org/bugzilla/attachment.cgi?id=27341
Corrupted file created by poi 3.7, workbook with 1371 sheets
I use the version of POI(3.7) to create 1400 sheets in a workbook. And when I
open the XLS file generated by the programe, the MS excel 2003 pops the error
like bellow.
Damage to the file was so extensive that repairs were not possible. Excel
attempted to recover your formulas and values, but some data may have been
lost or corrupted.
In addition, if the number of sheet is under 1370, it can be opened normally.
Also when I use POI 2.5.1 the workbook is generated fine.
Attached is the generated file and here is the test code:
package com.test;
import java.io.FileOutputStream;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.DataFormat;
//import org.apache.poi.ss.util.Color;
//import org.apache.poi.ss.util.Region;
public class poiTest36 {
Workbook m_wb;
Font m_boldFont;
CellStyle cellStyle;
poiTest36() {
m_wb = new HSSFWorkbook();
m_boldFont = m_wb.createFont();
m_boldFont.setBoldweight( Font.BOLDWEIGHT_BOLD );
cellStyle=m_wb.createCellStyle();
}
public void createSheet(){
Sheet sheet=m_wb.createSheet();
cellStyle.setFont(m_boldFont);
cellStyle.setBorderBottom( CellStyle.BORDER_MEDIUM );
cellStyle.setBorderRight( CellStyle.BORDER_MEDIUM );
cellStyle.setBorderLeft( CellStyle.BORDER_MEDIUM);
cellStyle.setBorderTop( CellStyle.BORDER_MEDIUM);
Row row=sheet.createRow(1);
Cell cell=row.createCell((short)1);
cell.setCellStyle(cellStyle);
cell.setCellValue("Felix S");
}
public void save( String filename) throws Exception {
FileOutputStream fileout = new FileOutputStream( filename );
m_wb.write( fileout );
fileout.close();
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
poiTest36 p = new poiTest36();
for(int i=0; i<1371; i++) {
p.createSheet();
}
try {
p.save("/home/fsanchez/tmp/test.xls");
}
catch (Exception e){
System.out.println("got exeption:" + e.getMessage());
e.printStackTrace();
}
}
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: DO NOT REPLY [Bug 51601] New: Excel 2003 and 2007 can not open
file generated by poi if the number of sheet in a workbook exceed 1370
sheets
Posted by janinestone <de...@hushmail.com>.
Unable opening excel file may denote data corruption
Make use of following application for opening excel file
http://www.recoverytoolbox.com/excel.html
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/DO-NOT-REPLY-Bug-51601-New-Excel-2003-and-2007-can-not-open-file-generated-by-poi-if-the-number-of-ss-tp4659251p5710429.html
Sent from the POI - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 51601] Excel 2003 and 2007 can not open file
generated by poi if the number of sheet in a workbook exceed 1370 sheets
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51601
--- Comment #1 from kalyan <ka...@gmail.com> 2011-08-02 17:38:42 UTC ---
As I see, this is because content of an excel record cannot exceed certain
value (in bytes). RecordInputStream.java's MAX_RECORD_DATA_SIZE value needs to
be modified. Its current value is 8224 bytes.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org