Yegor,

Thanks for the response,

with SXSSF API I am getting below error after downloading and opening sheet and 
data is not populated in the Input Tab.

  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <recoveryLog 
xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main";>
  <logFileName>error038200_01.xml</logFileName>
  <summary>Errors were detected in file 'C:\bhanu\temp\pfrsh.xlsm'</summary>
- <removedRecords summary="Following is a list of removed records:">
  <removedRecord>Removed Records: Cell information from 
/xl/worksheets/sheet4.xml part</removedRecord>
  </removedRecords>
  </recoveryLog>

Following is the sample code. Its working fine with XSSF API.

 String template_path = "C:\\templates\\template.xlsm";
       FileInputStream fileInputStream = null;
       FileOutputStream outputstream = null;
       try{
             fileInputStream = new FileInputStream(template_path);
             outputstream = new FileOutputStream(new 
File("C:\\temp\\temp.xlsm"));

            //loading the workbook form file system.
           SXSSFWorkbook sWorkbook = new SXSSFWorkbook(new 
XSSFWorkbook(fileInputStream),1000);

           SXSSFSheet inputSheet = (SXSSFSheet)sWorkbook.getSheet("Input Tab");

           for(int rowIndex =0;rowIndex<100;rowIndex++){
             Row row = inputSheet.createRow(rowIndex);
                  Cell cellRef = row.getCell(1,Row.CREATE_NULL_AS_BLANK);
                  cellRef.setCellType(Cell.CELL_TYPE_STRING);
                  cellRef.setCellValue("Test");
          }
          inputSheet.flushRows();
          sWorkbook.write(outputstream);

       }catch (Exception e) {
             e.printStackTrace();
      }finally{
            try {
                  fileInputStream.close();
                  outputstream.flush();
                  outputstream.close();
            } catch (IOException e) {
                  e.printStackTrace();
            }
      }


Bhanu
From: Yegor Kozlov-4 [via Apache POI] 
[mailto:[email protected]]
Sent: Monday, February 27, 2012 3:38 PM
To: Bhanu.Prakash2
Subject: Re: Need work around for out of memory issue

Use SXSSF: http://poi.apache.org/spreadsheet/how-to.html#sxssf

Yegor

On Mon, Feb 27, 2012 at 1:18 PM, Bhanu <[hidden 
email]</user/SendEmail.jtp?type=node&node=5518473&i=0>> wrote:

> HI All,
>
> While processing the Excel sheets in uploading and downloading functionality
> in web based application I am getting out of memory issue. Increasing the
> heap size will fix this issue but due to some other reasons we are limiting
> the heap size. So I am looking for work around for handling the large file.
> I have tried BigGridDemo examples as well,For current requirement it  is not
> suitable. Here is the overview of the problem.
>
> We have 3.2 MB Excel sheet template which contains the 21 sheets with lot of
> charts, styles  and static data. Among the 21 sheets, in Java we are
> interested in 3 sheets(contains plain text cells) which data will be pulled
> and populated from the database. After downloading business team will use
> this data for calculation purpose in  other sheets .To populate this 3
> sheets we are loading the whole workbook and we are getting the memory
> exception.
>
> Please let me know if there are any other ways to handle this requirement
> with very minimal memory.
>
>
> Thanks in advance.
>
> -Bhanu
>
>
> --
> View this message in context: 
> http://apache-poi.1045710.n5.nabble.com/Need-work-around-for-out-of-memory-issue-tp5518375p5518375.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden 
> email]</user/SendEmail.jtp?type=node&node=5518473&i=1>
> For additional commands, e-mail: [hidden 
> email]</user/SendEmail.jtp?type=node&node=5518473&i=2>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden 
email]</user/SendEmail.jtp?type=node&node=5518473&i=3>
For additional commands, e-mail: [hidden 
email]</user/SendEmail.jtp?type=node&node=5518473&i=4>


________________________________
If you reply to this email, your message will be added to the discussion below:
http://apache-poi.1045710.n5.nabble.com/Need-work-around-for-out-of-memory-issue-tp5518375p5518473.html
To unsubscribe from Need work around for out of memory issue, click 
here<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5518375&code=YmhhbnUucHJha2FzaDJAdGFyZ2V0LmNvbXw1NTE4Mzc1fC0xMDgwOTU5NjA0>.
NAML<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Need-work-around-for-out-of-memory-issue-tp5518375p5521267.html
Sent from the POI - User mailing list archive at Nabble.com.

Reply via email to