apache-poi

Apache POI 3.9 : WorkbookFactory method not found

你说的曾经没有我的故事 提交于 2019-12-30 05:47:03
问题 In my app I have used Apache POI 3.8 for XLS file processing. Now I want to migrate to Apache POI 3.9 latest and stable version. I have added the JAR file poi-3.9-20121203.jar in my application and removed JARs related to POI 3.8. But it seems that, in 3.9 version, the WorkbookFactory class has been removed. So how can I create a Workbook with WorkbookFactory in Apache POI 3.9 ? I extracted the JAR and checked, there is no class like WorkbookFactory . Can anyone tell me how to create a new

Fetch the data from Excel using Apache poi using java

柔情痞子 提交于 2019-12-30 05:28:06
问题 I need to fetch the Test data from the excel by passing the test case id. If i pass the Test case id as "TC005" - i need to get all the column values like Lab name, Lab Address, City, State , Pincode, Collection center Name, CC Address, City, State & Pincode. Can anyone tel me how to do it ?? I have worked on it, but I can get only one field. package com.utils; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import

How to copy a paragraph of .docx to another .docx with Java and retain the style

只愿长相守 提交于 2019-12-30 05:01:08
问题 I am trying to copy the content from a particular paragraph in a .docx to another empty .docx .the problem i have is that the style,bullets,numbering etc from the source.docx is not retained in the destination .docx.Here is my code can anyone please tell me what are the changes to be added to the above code? Thanks in Advance!! public class WordFinal { public static void main(String[] args) throws IOException, XmlException { XWPFDocument doc = new XWPFDocument(new FileInputStream("source.docx

HSSFWorkbook vs XSSFWorkbook vs SXSSFWorkbook - Apache-poi

旧城冷巷雨未停 提交于 2019-12-30 01:59:09
问题 HSSFWorkbook vs XSSFWorkbook and the advantages/disadvantages of XSSFWorkbook and SXSSFWorkbook ? 回答1: A spreadsheet of each with as a summary of API features: Source: https://poi.apache.org/spreadsheet/ 来源: https://stackoverflow.com/questions/33047512/hssfworkbook-vs-xssfworkbook-vs-sxssfworkbook-apache-poi

How can I create a simple docx file with Apache POI?

心已入冬 提交于 2019-12-30 01:36:04
问题 I'm searching for a simple example code or a complete tutorial how to create a docx file with Apache POI and its underlying openxml4j . I tried the following code (with a lot of help from the Content Assist, thanks Eclipse!) but the code does not work correctly. String tmpPathname = aFilename + ".docx"; File tmpFile = new File(tmpPathname); ZipPackage tmpPackage = (ZipPackage) OPCPackage.create(tmpPathname); PackagePartName tmpFirstPartName = PackagingURIHelper.createPartName("/FirstPart");

Issue while reading Excel document (Java code)

青春壹個敷衍的年華 提交于 2019-12-29 09:34:08
问题 I have some Java code which reads the Excel data. On running the Java code, it's showing the following error. Help me resolve the same. Also, I need to know other method of reading .xlsx file. (A small edit) how I can print rows with their respective columns. For example: Age 19 20 21 Salary 35k 20k 40k . . . Exception in thread "main" org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals

Unable to insert data using POI for null values in excel sheet

可紊 提交于 2019-12-29 09:17:12
问题 I'm trying to find a blank value in excel (xlsx) sheet and replace with some string like "ENTER VALUE" using my program with Apache POI library as below I'm able to read and identify blank/null values in excel sheet but couldnt insert any value into those cells public static void main(String args[]) throws IOException, InvalidFormatException { FileInputStream inputFile = new FileInputStream("//Users//suk//Documents/tes//testexcel.xlsx"); //now initializing the Workbook with this inputFie //

Android : Apache POI duplicate entry: org/apache/xmlbeans/xml/stream/Location.class error

笑着哭i 提交于 2019-12-29 09:07:23
问题 Hi I am getting following error while running my android project : Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/xmlbeans/xml/stream/Location.class I have searched about this issue on internet, differenet type of solutions provided few of them as below : 1] Enable multidex, (by doing `multiDexEnabled true`), 2] Remove support library v4 as v7 comes

How to get Page/Sheet Count of Word/Excel documents?

为君一笑 提交于 2019-12-29 08:56:11
问题 In my project I have one requirement to show the number of pages in Word documents (.doc, .docx) files and number of sheets in Excel documents (.xls, .xlsx). I have tried to read the .docx file using Docx4j but the performance is very poor but I need just the word count and tried using Apache POI. I am getting an error, something like: "trouble writing output: Too many methods: 94086; max is 65536. By package:" I want to know whether there is any paid/open source library available for android

How to Convert a ppt file into pdf file in Java?

霸气de小男生 提交于 2019-12-29 07:19:30
问题 I want to convert an MS powerpoint (ppt) document to PDF. I searched some jars like officetools.jar , but that requires purchase. Is there any way I can convert it through itext and apache POI like we do for doc to PDF? 回答1: I am using iText and apache poi: Following is the list of imports- 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