apache-poi

java.lang.OutOfMemoryError: GC overhead limit exceeded when loading an xlsx file

天大地大妈咪最大 提交于 2019-12-23 02:32:54
问题 I understand what the error means, that my program is consuming too much memory and for a long period of the time it is not recovering. My program is just reading 6,2Mb xlsx file when the memory issue occures. When I try to monitor the program, it very quickly reaches 1,2Gb in memory consumption and then it crashes. How can it reach 1,2Gb when reading 6,2Mb file? Is there a way to open the file in chunks? So that it doesn't have to be loaded to the memory? Or any other solution? Exactly this

Apache POI logging, does not log anything

非 Y 不嫁゛ 提交于 2019-12-23 02:04:30
问题 I'm trying to log out to help my find the error, but using the information from the apache poi page does not log anything, I expected something to happen in the console. System.setProperty("org.apache.poi.util.POILogger", "org.apache.poi.util.SystemOutLogger"); System.setProperty("poi.log.level", POILogger.INFO + ""); /*... some more code ...*/ case Cell.CELL_TYPE_FORMULA: evaluator.setDebugEvaluationOutputForNextEval(true); CellValue cellValue = evaluator.evaluate(valueCell); value =

Apache POI logging, does not log anything

人盡茶涼 提交于 2019-12-23 02:04:04
问题 I'm trying to log out to help my find the error, but using the information from the apache poi page does not log anything, I expected something to happen in the console. System.setProperty("org.apache.poi.util.POILogger", "org.apache.poi.util.SystemOutLogger"); System.setProperty("poi.log.level", POILogger.INFO + ""); /*... some more code ...*/ case Cell.CELL_TYPE_FORMULA: evaluator.setDebugEvaluationOutputForNextEval(true); CellValue cellValue = evaluator.evaluate(valueCell); value =

How to format cell in XWPFTable in Apache POI

折月煮酒 提交于 2019-12-23 01:52:14
问题 I am able to create a table in Apache POI in word ,my table is coming with proper value but what i want i want to decrease the cell size of the column size in the table how to do that ,please help..Here is what i have done upto XWPFTable table = document.createTable(5,3); r3.setText("MSH Activity Score Card"); r3.setBold(true); //creating first row table.getRow(0).getCell(1).setText("Job ID#"); table.getRow(0).getCell(2).setText("1362"); //creating second row table.getRow(1).getCell(1)

Replace text in text box of docx by using Apache POI

空扰寡人 提交于 2019-12-22 18:40:31
问题 I am using Apache POI to replace words of docx. For a normal paragraph, I success to use XWPFParagraph and XWPFRun to replace the words. Then I tried to replace words in text box. I referenced this https://stackoverflow.com/a/25877256 to get text in text box. I success to print the text in console. However, I failed to replace words in text box. Here are some of my codes: for (XWPFParagraph paragraph : doc.getParagraphs()) { XmlObject[] textBoxObjects = paragraph.getCTP().selectPath("declare

java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.POIXMLDocument on Jboss 5.0 EAP

微笑、不失礼 提交于 2019-12-22 18:39:18
问题 Getting following exception in Jboss 5.0 EAP but it work fine in JBoss 5.1 GA. we are using POI 3.7 and jars included are poi-3.7.jar poi-ooxml-schemas.jar poi-ooxml.jar The stack trace is ERROR [org.apache.catalina.core.ContainerBase.[jboss.ueb].[localhost].[fesbcon-Fig].[Faces Servlet]] 3;13;44.4g3pM (http-0.0.0.0-8280-1) Servlet.service() -For servlet Faces Servlet threu exception java.lang.NoClassDe-FFoundError: Could not initialize class org.apache.poi.POIXMLDocument at org.apache.poi.ss

Read empty cell using Apache POI Event model

时光总嘲笑我的痴心妄想 提交于 2019-12-22 18:37:34
问题 I have a huge excel file with tons of columns which looks like this :- Column1 Column2 Column3 Column4 Column5 abc def ghi mno pqr ...... The output generated by my code when I print all the values in excel is :- abc;def;ghi;null;null mno;pqr;null;null;null So, If we look at the output above we can note that the cells where I left blank values were not picked up by the POI library. Is there a way in which I can get these values as null? Or a way to recognize that the values presented skipped

How to open .xlsx files with POI SS?

给你一囗甜甜゛ 提交于 2019-12-22 17:08:02
问题 I am trying to open .xlsx files with POI SS with this code (taken from http://poi.apache.org/spreadsheet/quick-guide.html#ReadWriteWorkbook): InputStream inp = new FileInputStream("workbook.xls"); //InputStream inp = new FileInputStream("workbook.xlsx"); Workbook wb = WorkbookFactory.create(inp); Sheet sheet = wb.getSheetAt(0); Row row = sheet.getRow(2); Cell cell = row.getCell(3); if (cell == null) cell = row.createCell(3); cell.setCellType(Cell.CELL_TYPE_STRING); cell.setCellValue("a test")

How to open .xlsx files with POI SS?

送分小仙女□ 提交于 2019-12-22 17:07:13
问题 I am trying to open .xlsx files with POI SS with this code (taken from http://poi.apache.org/spreadsheet/quick-guide.html#ReadWriteWorkbook): InputStream inp = new FileInputStream("workbook.xls"); //InputStream inp = new FileInputStream("workbook.xlsx"); Workbook wb = WorkbookFactory.create(inp); Sheet sheet = wb.getSheetAt(0); Row row = sheet.getRow(2); Cell cell = row.getCell(3); if (cell == null) cell = row.createCell(3); cell.setCellType(Cell.CELL_TYPE_STRING); cell.setCellValue("a test")

reading excel file --> xlsx format with java

自古美人都是妖i 提交于 2019-12-22 14:58:26
问题 I'm trying to read an excel file (xlsx NOT xls) but without any luck. I tried the jexcel api but it doesn't support xlsx extension, then I tried the Apache api which need to work and tried also the example from their web site but with no luck.I can't pass the read file phase and get a filenotfound exception. also used the poi-ooxml-3.6.jar,xmlbeans-2.6.0 and poi-3.7.jar. can anyone please explain to me what types of api/classes/libraries I need to use and how to use it with eclipse (the