apache-poi

How do I find out Apache Buildr/Maven 2 repo names

左心房为你撑大大i 提交于 2019-12-17 15:35:19
问题 I'm just starting to use Apache Buildr and I'm constantly running into the problem of not knowing what repo urls and versions are available for me to use. For example I want to use Scala 2.8 in a build file, the id i previously used was: 2.8.0-SNAPSHOT But now this is not found. I also want to use the latest version of Apache POI. If I look on the maven2 repo: http://mirrors.ibiblio.org/maven2/ I can see that it only has up to version 3.2. Is there any standard way of finding repos and

Exception reading XLSB File Apache POI java.io.CharConversionException

笑着哭i 提交于 2019-12-17 13:06:17
问题 Im developing a Java aplication that reads an excel xlsb file using Apache POI, but I got an exception while reading it, my code is as follows: import java.io.IOException; import java.io.InputStream; import org.apache.poi.xssf.eventusermodel.XSSFReader; import org.apache.poi.xssf.model.SharedStringsTable; import org.apache.poi.xssf.usermodel.XSSFRichTextString; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.OpenXML4JException;

java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException

随声附和 提交于 2019-12-17 12:41:39
问题 In order to read an xlsx file I'm using apache POI, I've downloaded the zip and placed the following jsrs in my servlet location webcontent/web-inf/lib and configured build path through eclipse and my code looks as follows, 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; File uploadedFile = new File(fpath, fileName); item.write(uploadedFile); String mimeType =

POI 4 XPages - document generation works only once

China☆狼群 提交于 2019-12-17 12:36:52
问题 Ok, to be honest: the headline doesn't tell the whole truth. I am using a custom control with several buttons (save, close, edit etc.) and a button that executes a POI action - it's generates a Word file. I experience a problem here: after hitting the POI-button my other buttons (and the POI one as well) won't work anymore, no click is triggered. Now the strange one: after waiting a few seconds (depending on which browser I use, Chrome is fastest) I am able to click the buttons (all of them)

Can't Set Fill Color Apache POI Excel Workbook

强颜欢笑 提交于 2019-12-17 12:15:09
问题 I have scanned this forum over and over and tried every method mentioned on here and still can't get Apache POI to change to fill background color of my excel document. Here is my code: errorOccured = true; XSSFCellStyle cs = workbook.createCellStyle(); cs.setFillBackgroundColor(IndexedColors.RED.getIndex()); row.getCell(0).setCellStyle(cs); Do you know why this wouldn't work? What is the correct way to get row.getCell(0) to be filled with red (background color)? Thank you! 回答1: Use

How to convert HSSFWorkbook to XSSFWorkbook using Apache POI?

余生颓废 提交于 2019-12-17 11:02:20
问题 How to convert org.apache.poi.hssf.usermodel.HSSFWorkbook to org.apache.poi.xssf.usermodel.XSSFWorkbook in Apache POI? Environment : JSE1.6 JBossAS 4.3.2 POI 3.7 回答1: this code has been adapted from what I found here on coderanch forum public final class ExcelDocumentConverter { public static XSSFWorkbook convertWorkbookHSSFToXSSF(HSSFWorkbook source) { XSSFWorkbook retVal = new XSSFWorkbook(); for (int i = 0; i < source.getNumberOfSheets(); i++) { XSSFSheet xssfSheet = retVal.createSheet();

Determine MS Excel file type with Apache POI

ぐ巨炮叔叔 提交于 2019-12-17 10:41:53
问题 Is there a way to determine MS Office Excel file type in Apache POI? I need to know in what format is the Excel file: in Excel '97(-2007) (.xls) or Excel 2007 OOXML (.xlsx). I suppose I could do something like this: int type = PoiTypeHelper.getType(file); switch (type) { case PoiType.EXCEL_1997_2007: ... break; case PoiType.EXCEL_2007: ... break; default: ... } Thanks. 回答1: Promoting a comment to an answer... If you're going to be doing something special with the files, then rjokelai's answer

Obtain textbox value from Excel in Java

半城伤御伤魂 提交于 2019-12-17 10:04:29
问题 I have an Excel file and I need to read a value from a textbox inside that Excel file. I am using org.apache.poi library and I tried to obtain the value in the following way: List<HSSFObjectData> obj=workbook.getAllEmbeddedObjects(); for (int i = 0; i < obj.size(); i++) { HSSFTextbox t = (HSSFTextbox) obj.get(i); } Unfortunetly I couldn't cast HSSFTextbox to a HSSFObjectData element. Does anyone know how could this be done? 回答1: Maybe you can do like this: try { InputStream input = new

Apache POI evaluate formula

試著忘記壹切 提交于 2019-12-17 09:54:22
问题 I have some formulas in cells of my sheet, and I want to evaluate them after I insert some values. Ex : My formula is =SUM(B1,B2) Before values insertion B1 value was 1 , and B2 value was 3 , and the formula result is 4 After insertion of values now B1 has value 5 , and B2 has value 2 but the formula still produces 4 , how can I evaluate/trigger this to be calculated? Naturally after I hit the return button on the formula cell the new value 7 is calculated, is there a way to trigger this

How to get an Excel Blank Cell Value in Apache POI?

半城伤御伤魂 提交于 2019-12-17 09:19:07
问题 I have a huge excel file with tons of columns which looks like this :- Column1 Column2 Column3 Column4 Column5 abc def ghi mno pqr ...... This is the code that I wrote to print these values: try { FileInputStream inputStr = new FileInputStream(fileName); XSSFWorkbook xssfWork = new XSSFWorkbook(inputStr) ; XSSFSheet sheet1 = xssfWork.getSheetAt(0); Iterator rowItr = sheet1.rowIterator(); while ( rowItr.hasNext() ) { XSSFRow row = (XSSFRow) rowItr.next(); System.out.println("ROW:-->");