I wrote an example for you and I would like to ask you if there is a
different method to use your library because the following system uses too
ram and I must use the code *-Xms256m -Xmx3584m* but it makes instable the
operative system.
*Answer me please!*
/THE CODE:/
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
int a = 10;
int b = 10;
Double[][] d = new Double[a][b];
Double m = 1001d;
for (int i = 0; i < d.length; i++) {
for (int j = 0; j < d[0].length; j++) {
d[i][j] = m;
}
}
String nomefoglio = "z.xlsx";
String nomefile = "z.xlsx";
try {
FileInputStream file = new FileInputStream(new
File(nomefile));
XSSFWorkbook workbook = new XSSFWorkbook(file);
XSSFSheet sheet = workbook.getSheet(nomefoglio);
int rownum = 0;
int cellnum = 0;
for (int i = 0; i < a; i++) {
Row row = sheet.createRow(rownum++);
for (int j = 0; j < b; j++) {
Cell cell = row.createCell(cellnum++);
cell.setCellValue((Double) d[i][j]);
}
cellnum = 0;
}
file.close();
FileOutputStream outFile = new FileOutputStream(new
File(nomefile));
workbook.write(outFile);
outFile.close();
} catch (IOException e) {
e.printStackTrace();
}
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/Apache-POI-works-but-it-uses-too-RAM-is-it-a-limit-of-your-library-tp5712425p5712444.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]