I am trying to create excel files of moderate to large size (about 4 MB). I have
written some code to generate a file for this and I have also increased my JVM heap
size to 100 MB. The code compiles and runs without a problem. However, my Excel
application is unable open the file (e.g.. "Out of memory" or similar errors). I've
pasted my code below, does know why this is causing me a problem?
(I have already looked through the archives and noticed that someone had a similar
problem. The recommended solution was to increase the JVM heap size which I have
tried. Does anyone know what the heap size should be relative to the file size or
even if there is an issue with this)
Thank you in advance,
Nitin.
import org.apache.poi.hssf.usermodel.*;
import java.io.*;
public class createExcelSheet
{
public static void main(String args[]) throws Throwable
{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet1 = wb.createSheet("new sheet");
for (short index = 0; index < 600; index ++)
{
HSSFRow row = sheet1.createRow(index);
for (short index2 = 0; index2 < 500; index2++)
{
row.createCell(index2).setCellValue("goodbye");
}
}
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();
}
}
Visit our website at http://www.ubswarburg.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>