apache-poi

Values of excel field is getting 3.0E9 where I need 3000000000 when trying to parse

喜夏-厌秋 提交于 2019-12-25 05:13:33
问题 i have an excel to upload which has a column material id.That column contains alphanumeric values,But when i am trying to upload this file value the uploaded column in the jsp page is taking an unexpected E and also taking decimal of that number i am using apache POI to parse the excel.Here i have done so far while(rowIterator.hasNext()) { boolean isValidentry=true; System.out.println("Row number =" + (i+1)); Row row = rowIterator.next(); CategoryObject categoryObject = new CategoryObject();

Apache POI :- Get Headings from DOC file

我怕爱的太早我们不能终老 提交于 2019-12-25 05:05:43
问题 I am messing with apache poi to manipulate word document. Is there any way to get headings from a doc file? i am able to get plain text from the doc but I need to differentiate all headings from the document file?. IS any function available in apache poi api to get only headings from the ms word file?? 回答1: Promoting a comment to an answer There are two ways to make a "Heading" in Word. The "proper" way, and the way that most people seem to do it... In the styles dropdown, pick the

Making excel sheet read only

拥有回忆 提交于 2019-12-25 04:55:20
问题 I want read only excel sheet after creating it using Apache POI HSSF. How can I do that? 回答1: A detailed description can be found here: http://systeminetwork.com/article/locking-cells-hssf Basically you have to assign your cells a custom CellStyle with CellStyle.setLocked(true) Edited Hi Gaurav, here is the complete and working code: HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("sheet1"); /* password required for locks to become effective */ sheet

importing Apache POI Java

牧云@^-^@ 提交于 2019-12-25 04:47:22
问题 Hi I'm having a bit of trouble using the Apache POI library in java. I've downloaded and imported the library into my project, but am unable to import it into my java class. (like you would do): import java.awt.*; Am I looking at this the wrong way, or am I missing something? 回答1: If you are using maven, map de dependecies: <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.14</version> </dependency> Then import and use the apache poi library: import org

Exception in thread “main” java.lang.IllegalStateException: Cannot get a text value from a numeric cell

瘦欲@ 提交于 2019-12-25 03:52:36
问题 I have written code as below to fetch value from Excel. String CID = s1.getRow(i).getCell(0).getStringCellValue(); but in excel, 1st cell is a numeric value, but in above code I am trying to fetch String cell value. thats why I am getting error as : Exception in thread "main" java.lang.IllegalStateException: Cannot get a text value from a numeric cell Can anyone please provide a solution for this. how to fetch the numeric value from excel? 回答1: getCellType() for any cell gives you the type of

Using POI Set Cell Style Based on Cell Formula Result

一笑奈何 提交于 2019-12-25 03:43:27
问题 I need some help on setting the cell style base on the cell value. The code used to populate cell. String totalvariationweightv1 = "J" + (x+1); String totalvariationweightv2 = "L" + (x+1); cell85014.setCellType(Cell.CELL_TYPE_FORMULA); cell85014.setCellFormula("SUM(((" + totalvariationweightv2 + "-" + totalvariationweightv1 + ")/" + totalvariationweightv1 + ")*100)"); Then I need to color the field if it exceeds a certain value. Right now I just have alternating colors: cell85014.setCellStyle

Retrieving cell style information(specifically color) using POI event api

寵の児 提交于 2019-12-25 03:39:50
问题 Am trying to create a web application which reads an existing xls file(we do not control file creation ) using POI and java. The size of the uploaded file is quite large so the goal is to use event driven excel parsing APIs. I was not able to find any API to access cell colors using the event driven approach. However the uploaded excels have some logic based on the cell colors. Any one has an idea how I can go about it? Thanks! 回答1: You probably want a FormatTrackingHSSFListener - that will

Java program using apache poi 3.9 encountered error in XML build file

烂漫一生 提交于 2019-12-25 03:34:52
问题 Hi encountered an error in build xml. From the log i think that the error is with apache poi library "poi-ooxml-3.9-20121203" and regarding Java versions. I am currently using JDK 4 and apache poi 3.9. Buildfile: C:\POITest\build.xml init: clean: [delete] Deleting directory C:\POITest\build [delete] Deleting directory C:\POITest\dist init: [mkdir] Created dir: C:\POITest\dist [mkdir] Created dir: C:\POITest\build [mkdir] Created dir: C:\POITest\dist\lib compile: [javac] C:\POITest\build.xml

Read and Edit Excel in GWT Client Code

本小妞迷上赌 提交于 2019-12-25 02:58:22
问题 I have a GWT application with server and client code. I want to read and display an Excel (.xslx) file from the user in the GUI without passing it to the server. Is it possible to do this with the Apache POI or can't GWT compile all needed code from POI? 回答1: On the client side you will only be able to use this packages: http://www.gwtproject.org/doc/latest/RefJreEmulation.html You have to pass the excel to the server 来源: https://stackoverflow.com/questions/29649868/read-and-edit-excel-in-gwt

Apache POI autoSizeColumn() behaving weird

耗尽温柔 提交于 2019-12-25 02:53:33
问题 Please read full before marking as duplicate. I have seen all the related/similar questions already and I guess I have something weird happening here. I'm using Apache POI version 3.9 to generate a 4 sheet workbook. Every time I'm done filling the sheet, I auto-size the columns. Here's the code: for (String alias : map.keySet()) { Sheet sheet = workbook.createSheet(getSheetNameForAlias(alias)); List<Object[]> resultList = (List<Object[]>) map.get(alias); Collections.sort(resultList.subList(1,