poi « Development « Java I/O Q&A





1. How do I (should I?) use Apache POI HWPFDocument?    stackoverflow.com

I'm thinking about including the Apache POI into my application. Main goal is to output RTF document, but DOC would be nice, too. But the documentation is not very detailed about ...

2. Is there any java library (maybe poi?) which allows to merge docx files?    stackoverflow.com

I need to write a java application which can merge docx files. Any suggestions?

3. How can I create a simple docx file with Apache POI?    stackoverflow.com

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 ...

4. apache poi 3.6: Reading an xlsx file    stackoverflow.com

I have a relatively dumb newb question, Im trying to open an xlsx file for reading using the apache POI 3.6. XSSFWorkbook workBook = new XSSFWorkbook("C:\test.xlsx"); The xlsx file was saved in excel ...

5. Invalid header signature; IOException with Apache POI on excel document    stackoverflow.com

I'm getting: java.io.IOException: Invalid header signature; read 0x000201060000FFFE, expected 0xE11AB1A1E011CFD0 when trying to add some custom properties to an excel document using apache POI HPSF. I'm completely sure the file is excel OLE2 (not ...

6. java.lang.NoSuchMethodError: org.apache.poi.util.IOUtils.copy(Ljava/io/InputStream;Ljava/io/OutputStream;)    stackoverflow.com

I am trying to read the xmlsx file using poi API, when i execute the code in my local system its executes fine but in server it throws exception

...

7. How to generate RSID attributes correctly in Word .docx files using Apache POI?    stackoverflow.com

I have been using Apache POI to manipulate Microsoft Word .docx files — ie open a document that was originally created in Microsoft Word, modify it, save it to a new ...

8. Getting Error to retrieve xlsx file data using XSSFReader(Apache POI API)?    stackoverflow.com

I tried to read larger Xlsx file using XSSFReader(Event API).when i tried use it,i got the following error,i could not able to resolve it.

parser-org.apache.xerces.parsers.SAXParser@1d10a5c
Processing new sheet:
A1 - empID
Exception in thread "main" ...

9. Getting Exception(org.apache.poi.openxml4j.exceptions) when reading xlsx file using Apache poi?    stackoverflow.com

i'm using Apache POI(XSSF API) for reading xlsx file.when i tried to read file.i got the following error:

org.apache.poi.POIXMLException: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]
Code:
public class ReadXLSX
{
private String filepath;
private ...





10. Apache POI - SXSSF: to where does it flush rows not in the window prior to output to file?    stackoverflow.com

Using the following documentation: http://poi.apache.org/spreadsheet/how-to.html#sxssf According to this site:

SXSSF (package: org.apache.poi.xssf.streaming) is an API-compatible streaming extension of XSSF to be used when very large spreadsheets have to ...

11. ClassCastExcepiton Using POI    coderanch.com

Hi, I am reading an excel file using POI api I am getting Classcast exception for the below line.. HSSFWorkbook wb1 = new HSSFWorkbook(); POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filename); Below is the Excepiton I am getting ..Please let me know if anybody has comeacross this type of error and any solution to the same.. java.lang.ClassCastException at java.util.TreeMap.compare(TreeMap.java:1081) at java.util.TreeMap.put(TreeMap.java:459) at ...

12. Using POI - Connection reset by peer    coderanch.com

A friendly place for programming greenhorns! Register / Login Java Forums Java I/O and Streams Using POI - Connection reset by peer Post by: Pat Flickner, Ranch Hand on Nov 14, 2006 11:30:00 I'm successfully creating Excel spreadsheets usiing Apache's POI, but I've just hit an odd snag: I'm getting "Connection reset by peer: socket write error" when I ...

13. apache POI - HWPF search & replace    coderanch.com

Hi, I'm looking for a way to find and replace strings in a MS word file. Actually I was not able to find the right method to do that in the apache poi library api. Could anyone help me? Basicly my application take a word file in input (template) and replace defined keys (like "${AMOUNT}") with values. To do that, I ...

14. POI File Not Compiling Problem    coderanch.com

Hi, My guess would be the ReadExcel.java file compiles when put in the jdk/bin folder because that is where is javac.exe file is present. When you move it to the WEB-INF folder it is not able to find the javac.exe file. That is why I mentioned about the PATH variable. Add the jdk/bin in the PATH environmental variable and execute the ...

16. Apache POI - HWPF writing a String    coderanch.com

import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.usermodel.CharacterRun; import org.apache.poi.hwpf.usermodel.Range; import org.apache.poi.poifs.filesystem.POIFSFileSystem; public class ms { public static void main(String[] args) throws IOException { File file = new File("hello.doc"); POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); HWPFDocument doc = new HWPFDocument(fs); Range range = doc.getRange(); CharacterRun run = range.insertAfter("hello"); OutputStream out = new FileOutputStream(new File("out.doc")); doc.write(out); ...





17. problem with reading text by POI Apache.    coderanch.com

hi, I wrote the code below to extract text from MS Word doc. it's working well except when it reads the last word of the paragraph I guess it read the new line as well, fro example when I retrieve the length of last token it returns the length of the token plus one.since I wanna compare this token with others ...

18. POI apache Reading Excel (strange case)    coderanch.com

Hello everyone...! Here i have a very interesting case. I have 1 single xls file which is saved under Ms. Excel 2003. The idea here is that the Tarikh Cell is using a Date Value; instead of Calculation. Thus, I put the words; "12/12/2001" ---> look at the preview above. Very funny when I use the POI apache to read those ...

20. Apache Poi    coderanch.com

21. POI    coderanch.com

22. Generate large excel using POI    coderanch.com

I got the Solution. package jwala; import java.io.*; import java.util.*; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.util.CellReference; import org.apache.poi.xssf.usermodel.*; public class BigGridDemoMultiSheet { public static void main(String[] args) throws Exception { // Step 1. Create a template file. Setup sheets and workbook-level objects such as // cell styles, number formats, etc. XSSFWorkbook wb = new XSSFWorkbook(); ...

23. Help needed in using POI for manipulating Word files    forums.oracle.com

Hi , I am new to POI. I have to take multiple files as input and write them to an output word file using POI.The input files may be word files, jpg or or any other image files and excel sheets also. Is this possible using POI?Is there any example source code available? I had another concern .I have downloaded the ...

24. problem redaing .xlsx file using poi api    forums.oracle.com

25. Unable to read .xlsx file in POI 3.5 beta    forums.oracle.com

Hi, I am trying to read an excel file by using the code: fs = new POIFSFileSystem( new BufferedInputStream(istream)); this works fine for .xls format. But doesnt work for .xlsx format. I am using poi-3.5-beta5-20090219.jar (poi 3.5 is said to support .xlsx format) I get following error: The supplied data appears to be in the Office 2007+ XML. POI only supports ...

26. how to read data from .xlsx file using poi 3.5    forums.oracle.com

I need another help. I saved an xlsx file to xls 2003 format. The excel sheet contains sevral macros for some columns. I entered the values the macro functions are working perfectly. but when try to insert the data from the excelsheet into the oracle database using poi3.2 it shows the following error. org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance. Please help ...

27. how to read data from .xlsx file using poi    forums.oracle.com

hi I need to upload the data from database to an .xlsx Excel sheet using poi in jsp. What are tha jar files should i import?. I imported poi-3.5 beta jar, poi-ooxml 3.5 beta jar file ,oppenxml4j.jar ,xbean.jar.But if i comopile it's showing the following error java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTSheet at org.apache.jsp.read_jsp._jspService(org.apache.jsp.read_jsp:69) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) Please ...

28. writing word file using POI    forums.oracle.com

29. Reading xlsx file using Apache POI    forums.oracle.com

XSSFWorkbook wb = new XSSFWorkbook(is); XSSFSheet sheet = wb.getSheetAt(0); int rows = sheet.getPhysicalNumberOfRows(); for (int r = 0; r < rows; r++) { XSSFRow row = sheet.getRow(r); int cells = row.getPhysicalNumberOfCells(); for (int c = 0; c < cells; c++) { XSSFCell cell = row.getCell(c); String value = null; switch (cell.getCellType()) { case XSSFCell.CELL_TYPE_FORMULA: value =cell.getCellFormula(); break; case XSSFCell.CELL_TYPE_NUMERIC: value = ...