apache-poi

Exception when reading XLSM workbook via Apache POI

烂漫一生 提交于 2020-01-05 04:01:08
问题 I'm trying to read .xlsm file using Apache POI library (3.8-beta5): Workbook wb = null; try { wb = WorkbookFactory.create(isXLSFile); } catch (IOException e) { ... nothing complicated. While generally documents are being read well, one document throws an exception: Caused by: java.lang.IllegalStateException: A sheet hyperlink must either have a location, or a relationship. Found: <xml-fragment ref="H13" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc=

How to read font size and font name in .docx in Apache POI(java)

狂风中的少年 提交于 2020-01-05 01:42:47
问题 Here is my code. XWPFRun run = runlist.get(0); double fontsize = (double)(run.getFontSize()); String fontfamily = (String)run.getFontFamily(); When it read the .docx file it will sometimes return -1 in font size and null in font family. I know that it's because they are default value but I don't want -1 and null I just want the name of that default value. How can I read it? 回答1: The font/character properties on a XWPFRun only return the override details, so settings which are different on

Mixed Modular and Non-Modular Development in Eclipse using Java 11

…衆ロ難τιáo~ 提交于 2020-01-04 14:03:15
问题 It's been a while since I do Java programming and I am surprised to come back to it with the entire landscape being foreign to me post project jig-saw. I have trouble using Eclipse (2018-09, 4.9.0) standard Java project with mixed modular and non-modular environment. Specifically, I am attempting to combine JavaFX 11 (modularized) and Apache POI 4.1 (non-modularized) using Eclipse platform (base Java project without Gradle or Maven). In my module-info.java I have the following, module myapp {

Java Memory issue using Apache.POI to read write Excel

夙愿已清 提交于 2020-01-04 06:44:09
问题 I am trying to read excel file...make some changes...save to new file. I have created small form with button...On pressing button.. It will load Excel file and load all data to Array list of class I have created. It will loop through Array list and change few properties in objects. It will save data to new Excel file. Finally, it will clear Array list and show message box of completion. Now the problem is memory issue. When form is loaded, I can see in windows task manager...javaw is using

Does anyone have an example of Apache POI converting PPTX to PNG

天大地大妈咪最大 提交于 2020-01-04 05:09:40
问题 Does anyone know of a good example of converting a PPTX powerpoint presentation to some form of image? PNG/GIF/etc? I can do it for a PPT but looking for a PPTX conversion example Thanks 回答1: In the meantime it works (... copied it from there): import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.FileInputStream; import java.io.FileOutputStream;

Does anyone have an example of Apache POI converting PPTX to PNG

半世苍凉 提交于 2020-01-04 05:09:09
问题 Does anyone know of a good example of converting a PPTX powerpoint presentation to some form of image? PNG/GIF/etc? I can do it for a PPT but looking for a PPTX conversion example Thanks 回答1: In the meantime it works (... copied it from there): import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.FileInputStream; import java.io.FileOutputStream;

How to unmerge cells in a spreadsheet using apache POI java library

拟墨画扇 提交于 2020-01-04 03:51:10
问题 We can use sheet.addMergedRegion(rowFrom,rowTo,colFrom,colTo); for adding merged cells in the sheet But I already have a sheet with merged cells in it and I want to unmerge these cells. Is there any way to unmerge cells of a sheet without creating new sheet using Apache POI ? 回答1: Promoting a comment to an answer... The method you want is Sheet.removeMergedRegion(int) That takes the index of the region, which you got when you added it. Otherwise, you can use getNumMergedRegions() and

Excel warning : File is in different format than specified by the file extension

送分小仙女□ 提交于 2020-01-04 02:42:06
问题 In my application, I am using apache POI 3.8 for report generation. The system is working fine and its generating report in xls format. But when I open the xls file it given me warning before opening the file. And here is the response type I am using... response.setHeader("Content-Type", "application/vnd.ms-excel"); response.setHeader("Content-Disposition","attachment; filename="+xlsFileName+".xls"); I also tried with ... response.setHeader("Content-Disposition","attachment; filename="

What is the difference in java.lang.OutOfMemory: GC Overhead limit exceeded vs. java.lang.OutOfMemory: Multicast listener

こ雲淡風輕ζ 提交于 2020-01-04 02:07:28
问题 I am investigating the slowness in our application and eventually one of the instances in a cluster environment going down. Few weeks back I came across the error below: [#|2012-05-11T14:12:03.460-0400|SEVERE|sun-appserver2.1|javax.enterprise.system.container.web|_ThreadID=89;_ThreadName=httpSSLWorkerThread-7311-0;_RequestID=7afaee11-c970-40dd-b5fb-29498af8e512;|StandardWrapperValve[LoginModule]: PWC1406: Servlet.service() for servlet LoginModule threw exception java.lang.OutOfMemoryError: GC

Convert doc file to html using Apache Poi

一曲冷凌霜 提交于 2020-01-03 18:57:09
问题 I am working on an android application in which i need to convert MS office files to HTML using Apache Poi. Till now i am able to convert .xlsx to htm using the following project Source- http://display-msoffice-docs-android-with-apache-poi.googlecode.com/svn/trunk/TestOfficeAndroid/ i can see that there is a WordToHtmlConverter class in org.apache.poi.hwpf.converter package which can convert .doc file in its main method as its main() method takes the input file path and output file path as