poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 53514] blank row getting created after row no 32767
Date Mon, 16 Jul 2012 10:09:22 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=53514

--- Comment #5 from Angshuman <asthanpati@corbus.com> ---
Here is the full code that i am using..

try {


    int headerLength = 15;
    int noofrows = 2048575;


    SXSSFWorkbook workbook = new SXSSFWorkbook(50);
    workbook.setCompressTempFiles(true);


    SXSSFSheet  worksheet=null;



    String header = "";
    CellStyle cellStyle = workbook.createCellStyle();

    Font font = workbook.createFont();
    Font fontd = workbook.createFont();

    String data = "";

    SXSSFCell cell=null;
    CellStyle cellStyle1=null;

    SXSSFRow row=null;
    int sheetNo=1;

    cellStyle.setFillForegroundColor(IndexedColors.ROYAL_BLUE.index);
    cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    font.setColor(IndexedColors.WHITE.index);
    font.setFontHeightInPoints((short)10);
    font.setFontName("Arial");
    cellStyle.setFont(font);

    fontd.setColor(IndexedColors.BLACK.index);
    fontd.setFontHeightInPoints((short)10);
    fontd.setFontName("Arial");

    System.out.println("Matrix Report noofrows::"+noofrows);
    for(long i = 0,rowNo=1 ; i < noofrows;i++,rowNo++){

    if(rowNo==1048575)
    {
    rowNo=1;
    sheetNo++;
    }    
    if(rowNo==1)
    {
    worksheet = (SXSSFSheet) workbook.createSheet("Matrix Report "+sheetNo);

    row = (SXSSFRow) worksheet.createRow(0);

    for(int hl=0; hl<headerLength; hl++){
    cell = (SXSSFCell) row.createCell(hl);
    header = hl+"";
    cell.setCellValue(header);
    cell.setCellStyle(cellStyle);

    cell=null;
    }
    }

    row = (SXSSFRow) worksheet.createRow((int)rowNo);



    cellStyle1 = workbook.createCellStyle();

    if(rowNo%2 != 0){
   
cellStyle1.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.index);
    cellStyle1.setFillPattern(CellStyle.SOLID_FOREGROUND);
    }

    cellStyle1.setFont(fontd);

    for(int j=0; j<headerLength; j++){

    cell = (SXSSFCell) row.createCell(j);
    data = j+"";

    if(data==null) data="";

    try{
    cell.setCellValue(Long.parseLong(data));
    }catch(NumberFormatException e){
    try{
    cell.setCellValue(Double.parseDouble(data));
    }catch(NumberFormatException ee){
    cell.setCellValue(data);
    }catch(NullPointerException ee){
    cell.setCellValue(data);
    }
    }catch(NullPointerException e){
    cell.setCellValue(data);                                
    }

    cell.setCellStyle(cellStyle1);

    cell=null;
    data=null;
    }
    cellStyle1=null;
    row=null;

    }

    FileOutputStream fileOut = new FileOutputStream("MatrixReport.xlsx");
    workbook.write(fileOut);
    fileOut.close();

    }catch(Exception e)
    {
        e.printStackTrace();
    }

-- 
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


Mime
View raw message