apache-poi

How to solve the java heap space error while loading the large xls file using POI

怎甘沉沦 提交于 2019-12-08 11:31:33
问题 I am trying to load and parse a xls file which is of 11mb and I am using WorkbookFactory.create(myFile)) to load it.But I am not able to load this file and parse it.Can anyone help me out of this this the code I am using in my program , public class LargeExcelManager { private Workbook wb ; public Workbook getWb() { return wb; } public void setWb(Workbook wb) { this.wb = wb; } public LargeExcelManager(String fileName)throws Exception { openWorkbook(fileName); } private void openWorkbook

What is the default Japanese font when using Apache POI HSLFSlide.draw?

烈酒焚心 提交于 2019-12-08 11:00:22
问题 I am using Apache POI to convert pptx slide to image. In the pptx slide, I have Japanese text in GE Inspira font that is not available in my system (comment out ge.registerFont(font) to simulate that). The generated image shows the Japanese text in a default font (see image here). What font is that and where is this default font set? When I register the font, the Japanese text appears as boxes (see image here). This is because GE Inspira font does not support Japanese characters. Is there a

Heap space error with Apache POI XSSF

馋奶兔 提交于 2019-12-08 10:44:40
问题 I am trying to parse a large excel file(.xlsx) using Apache POI XSSF library. After 100,000 rows it throws heap space error. I tried increasing the memory but it does not help. Is there a workaround for this problem? Or can someone suggest me a another library to parse large excel files. Thanks! 回答1: You can use http://poi.apache.org/spreadsheet/how-to.html#xssf_sax_api Have a look at this thread for details. Efficient way to search records from an excel file using Apache-POI 回答2: Try the

How to change margins when converting with apache poi

假装没事ソ 提交于 2019-12-08 10:38:22
问题 I need to change the margin of the PDF file when I convert from Microsoft Word document. public class TestCon { public static final String DEST = "./test.pdf"; public static final String SRC = "./test.docx"; public static void main(String[] args) { try { InputStream doc = new FileInputStream(new File(SRC)); XWPFDocument document = new XWPFDocument(doc ); CTSectPr addNewSectPr = document.getDocument().getBody().addNewSectPr(); CTPageMar addNewPgMar = addNewSectPr.addNewPgMar(); addNewPgMar

W/ System err: http://xml.org/sax/properties/declaration-handler when reading xlsx files

人盡茶涼 提交于 2019-12-08 10:25:00
问题 I am trying to read xlsx file in android. yet everytime I get another error when using apache-poi 4.0.1 . Code: OPCPackage pkg = OPCPackage.open(new File(filePath)); Workbook excelWorkBook = new XSSFWorkbook(pkg); Error: 2019-07-09 08:21:47.227 24171-24171/com.example.myapplication E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.myapplication, PID: 24171 org.apache.poi.ooxml.POIXMLException: http://xml.org/sax/properties/declaration-handler at org.apache.poi.ooxml.POIXMLFactory

Apache POI and EXCEL

余生颓废 提交于 2019-12-08 09:27:12
问题 I'm using Apache POI API to access an Excel .xlsx file, using the API I can read/write cells. My problem is: How can I do that with the .xlsx file opened in Excel GUI? If I try to do that I have conflict arising from concurrent access to the same resource (The process cannot access the file because it is being used by another process). I have been told that the answer is Excel RTD and c#, c++ or other languages. BUT I want to stick with Java,what could I do? Is switching to linux an option?

Validation : how to check if the file being uploaded is in excel format? - Apache POI

隐身守侯 提交于 2019-12-08 08:59:25
问题 Is there any way I can check if the file being uploaded is in excel format? I am using Apache POI library to read excel, and checking the uploaded file extension while reading the file. Code snippet for getting the extension String suffix = FilenameUtils.getExtension(uploadedFile.getName()); courtesy BalusC : uploading-files-with-jsf String fileExtension = FilenameUtils.getExtension(uploadedFile.getName()); if ("xls".equals(fileExtension)) { //rest of the code } I am sure, this is not the

Upgrading from .xls to .xlsx with POI

本秂侑毒 提交于 2019-12-08 08:49:11
问题 I have a web application In which i have excel file(.xls) download option. Now I Have to provide that feature in .xlsx I am trying to Use POI Jar. When I try to do that as a stand alone Application it works fine, but when I try to integrate that into a web application, I am getting an error as Excel Found Unreadable Content in FILENAME.xlsx. do you want to recover the content of this workbook? If you trust the source of this workbook click yes! XSSFWorkbook w = FileName

How to manipulate content of a comment with Apache POI

爱⌒轻易说出口 提交于 2019-12-08 08:21:32
问题 I would like to find a comment in Docx document (somehow, by author or ID...), then create new content. I was able to create a comment, with the help of this answer, but had no luck with manipulation. 回答1: As said in my answer linked in your question, until now the XWPFdocument will only read that package part while creating. There is neither write access nor a possibility to create that package part. This is mentioned in XWPFDocument.java - protected void onDocumentRead(): code line 210: "//

Writing a List instance to Excel file - Apache POI

好久不见. 提交于 2019-12-08 08:21:24
问题 I have a List of String objects that are pipe delimited. something like this: String1|String2|String3 String4|String5|String6 ... Using Apache POI as excel library, is it possible to iterate over entire List writing out the string object as each row in the excel file? i.e. something like: for (String inst : <List instance>) <sheetInstance>.write(inst) i.e. output the string directly to the excel as a row entry rather than setting each cell value with a string i.e. setting row 1, cell 1 =