apache-poi

The PoiReadExcelFile class will read in the 'poi-test.xls' file into an HSSFWorkbook object

风流意气都作罢 提交于 2019-12-25 02:51:31
问题 I've created this code and The PoiReadExcelFile class will read in the 'poi-test.xls' file into an HSSFWorkbook object. The 'POI Worksheet' will then be read into an HSSFWorksheet object, and then the values within the A1, B1, C1, and D1 cells will be read and displayed to standard output. import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Date; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel

The PoiReadExcelFile class will read in the 'poi-test.xls' file into an HSSFWorkbook object

馋奶兔 提交于 2019-12-25 02:51:15
问题 I've created this code and The PoiReadExcelFile class will read in the 'poi-test.xls' file into an HSSFWorkbook object. The 'POI Worksheet' will then be read into an HSSFWorksheet object, and then the values within the A1, B1, C1, and D1 cells will be read and displayed to standard output. import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Date; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel

How to move images in an excel sheet with java

☆樱花仙子☆ 提交于 2019-12-25 02:48:21
问题 I have an XSSFSheet with images at the end of my used rows. When adding a new row, I would like to shift all images one row down. I have found this similar question about moving charts, and have tried to use the part of the answer that does the actual moving of the charts, because It looked like it would work for images as well. java.util.List<CTTwoCellAnchor> drawingAnchors = ((XSSFDrawing)sheet.getDrawingPatriarch()).getCTDrawing().getTwoCellAnchorList(); for (CTTwoCellAnchor drawingAnchor

Validating the excel date for MM/dd/yyyy format

冷暖自知 提交于 2019-12-25 02:26:14
问题 I am using Apache POI to read Excel file(.xlsx) and validate its contents. We are having a date field in excel whcih should be in format MM/dd/yyyy. Suppose if the date fild has two values as follows, 1) 04/24/2014 2) 04242014 I have to accept the first one and reject the second. Since excel stores both these values in integer format, I am not able to differentiate them. Please suggest if you have any idea about how to solve this. 回答1: Apache POI allows to check data format of the cell with:

From java, how to be notified when excel spreadsheet is closed given multi spreadsheets in one instance

匆匆过客 提交于 2019-12-25 02:26:03
问题 I have java program that starts excel spreadsheet for them command line and wait for it to be closed to take next action as below. (btw my excel runs macro so I close the spreadsheet automatically when my macro finish executing to indicate it is done) p = Runtime.getRuntime().exec("cmd /c start /wait C:\\"+excelSheet); p.waitFor(); System.out.print("finished "+count + " "+ excelSheet); However I want my java program to starts 2 excel spreadsheets and each time one sheet closes, I want to take

How to group the values which are in excel to a HashMap

拈花ヽ惹草 提交于 2019-12-25 02:01:24
问题 i have the following excel: Method Name Status Code getLoggedinUserDetails 400 createRequisition 400 excelMDM 400 and i am able to print the values as they are in excel using the following code : package com.poc.excelfun; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Iterator; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss

NPOI Page Breaks

↘锁芯ラ 提交于 2019-12-25 01:55:58
问题 I am using the NPOI framework to generate a 97/2003 Excel workbook. I need to set a page break every 44 rows and from the example provided in the framework download, the code to do this is: sheet.SetRowBreak(int row) I can verify these are setting a collection of row integers but when opening the document and viewing the Page Break preview, there is but a single page that encompasses the entire worksheet. Sample Code below: for(int rowCount = 0; rowCount < MaxRows; rowCount += 44) { worksheet

fetch excel cell display value using Apache POI

点点圈 提交于 2019-12-25 01:29:39
问题 Below shows the highlighted cell which display as - (hyphen) but actually has 0 value inside it. It's a formula cell with following custom formatting. It's a formula cell but when the result is 0 , it displays as - . My requirement is to fetch - instead of 0 . cell2Update = sheet.getRow(4).getCell(3); cell2Update.setCellType(Cell.CELL_TYPE_NUMERIC); System.out.println(cell2Update.getStringCellValue());//Exception System.out.println(cell2Update.getNumericCellValue());//Display as 0 Please help

How to replace text(tag) with HTML in docx using Apache POI?

自闭症网瘾萝莉.ら 提交于 2019-12-25 01:07:55
问题 We are going to have some template docx file, where will be some tags like ${content}. I need to replace this tags with HTML. For this purpose I want to use altChunk element in XWPFDocument. Following answer in How to add an altChunk element to a XWPFDocument using Apache POI, I could place altChunk in the end of docx. How can I replace my tag with it? Or could I use any other libraries, may be docx4j? UPD: Template docx files with tags are created by end users with MS Word and looks like:

How do you convert a .ppt file to html using Apache POI?

冷暖自知 提交于 2019-12-25 01:05:56
问题 I'm looking for a solution capable of producing a result as close to the original as possible, such as this example, which converts .doc rather than .ppt files. It should, ideally, take in a FileInputStream and output a String with the desired html code. I've come across this question, which posts code very similar to that on the Apache POI website, however it converts to an image and I've been unable to re-purpose it. Otherwise, there seems to be next to no code out there to do this. EDIT: I