Jakart POI HWPF
I am trying to create/edit a Word document using a pure Java approach. So far the most succesful approach has been using JIntegra (which claims that can do everything that you can do with VBA). However, JIntegra has a commercial license. So, I am trying to look into Jakarta POI which has been in development for ever. It seems to have some functionality that I can use as far as creating/editing word documents but one big fuctionality that I need is inserting images, which so far I haven't been able to figure out.
Any body out there has been succesful at implementing an application using POI HWPF, if so, I will really appreciate your input.
Regards,
Paul
I have the same problem. Right now, we're using libraries from the JACOB project
(http://danadler.com/jacob/), but I haven't been able to find any really helpful documentation. If anybody
has another solution, I'd be thrilled to hear about it also.
Similar Messages
-
Issue with using poi.hwpf.HWPFDocument in servlet on Apache 6.0.16
Hi Friends,
I have come to the point where I just don't know what to do now. I am trying to extract text from a word document using the POI from apache. When I run the program locally there is no issue at all. However, when I try to run it on through a servlet I get the above error. I have read somewhere else that this might have something to do JRE, etc.
All help will be highly appreciated.
Here is the stack trace of the issue:
17-08-2008 16:17:49 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet UploadFileDataServlet threw exception
java.lang.NoSuchMethodError: org.apache.poi.POIDocument: method <init>()V not found
at org.apache.poi.hwpf.HWPFDocument.<init>(HWPFDocument.java:113)
at myDataSharer.reader.MSWordParse.getDocWords(MSWordParse.java:48)
at myDataSharer.dataset.UploadFileDataServlet.doPost(UploadFileDataServlet.java:165)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Source code of the program running locally :
* To change this template, choose Tools | Templates
* and open the template in the editor.
package myDataSharer.reader;
import org.apache.poi.hwpf.extractor.*;
import org.apache.poi.POIDocument;
import java.io.*;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hwpf.*;
* @author MDANANI
public class MSWordParse {
private String fileName = "";
public MSWordParse() {
public static void main(String[] args){
MSWordParse wp = new MSWordParse();
System.out.println(wp.getDocWords());
public String getDocWords() {
String docWords = "";
this.fileName = "c:/Project1.doc";
try {
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(fileName));
// Create a document for this file
HWPFDocument doc = new HWPFDocument(fs);
WordExtractor we = new WordExtractor(doc);
docWords = we.getText();
} catch (Exception e) {
e.printStackTrace();
return docWords;
return docWords;
}i have added commons-fileupload.jar but the error still remains.
Please take a look at this line of exception:
Please adjust your web.xml to use org.apache.myfaces.webapp.filter.ExtensionsFilter
whereas in my web.xml Extensions filter is from:
org.apache.myfaces.component.html.util.ExtensionsFilter
I get a broken link error if i try to point to org.apache.myfaces.webapp.filter.ExtensionsFilter -
How to read .doc files using jakarta POI api......
Hi all,
I've googled a lot on reading the file contents of an MS word file. I couldn't get a solution yet. Can you please give some sample codes for using the POI api for extracting only the text contents from an MS word file.
Thanks and Regards,whenever i click the folders, it's taking
to the internal folders. but there's no
option to download the whole package.Thats because you're looking at a tool which displays the contents of an svn repository through a web site.
What you need is a subversion client (the repository is a subversion repository).
There are several easy to use clients available:
Here's two:
1) subclipse: If you use eclipse. Dammed great tool IMHO. http://subclipse.tigris.org/
2) tortoise svn http://tortoisesvn.tigris.org/
When you've got a client, you'll need to give it a repository URL from which to check out.
For the POI project, that URL is http://svn.apache.org/repos/asf/jakarta/poi/trunk/
~D -
Apache Jakarta POI in PL/SQL
Hi all,
Any one has code sample for how to integrate Apache Jakarta POI in PLSQL...
Thanks for your help.
RajaHi,
Thanks for your reply.
Yes I have seen this document. Our requirement is writing data from multiple tables into same worksheet and at the same time XL will have different worksheets.
Regards,
Raja -
Hi all,
Any one has code sample for how to integrate Apache Jakarta POI in PLSQL...
Thanks for your help.
RajaThis is the standalone Forms forum, you would increase chances to get an answer by posting in either:
the PL/SQL forum - PL/SQL
the Oracle Applications Server forum - Oracle Application Server - General -
I need a link where I can find "Apache POI - HWPF" jar file
I want to create a program that reads a word document and I can not find the .jar file of "Apache POI - HWPF". Can anybody send me the link from where I can download it? 10x
I modified my code as below:
import java.io.*;
import org.apache.poi.hwpf.extractor.*;
public class Word_Reader
public static void main (String args[])
try
InputStream is = new BufferedInputStream(new FileInputStream("test.doc"));
WordExtractor wd = new WordExtractor(is);
String text = wd.getText();
System.out.println(text);
catch(FileNotFoundException e1)
System.out.println("File does not exist.");
catch(IOException e2)
System.out.println("IO Exception");
I get printed on console: "IOException". What is wrong in my code? -
Jakarta POI Excel97-2000 (Excel 2003?)
Hi All
I need to read data from Excel 2003 spreadsheet using my java program.
I looked at Jakarta POI, and JDBC-ODBC bridge options.
POI says Excel97-2000
Creating system DSN does not show Excel 2003 options. It shows Excel97-2000, Excel 3.0 etc
My environment is Windows XP 2002.
Can I read Excel 2003 documents using POI?
If I deploy this program on a machine which has earlier versions of excel on it will it be able to read.
I just have plain text in excel spreadsheet.
Please let me know.
Thanks
bibHard to answer this question definitively because it very much depends upon exactly what is in the file. If you have saved a complex, formatted document that makes extensive use of features that were introduced into Excel for version 2003 then you will face problems. If the file contains simply plain text, then you should be fine. Most of the API authors base their product on an earlier version of the BIFF8 format to ensure compatibility with as wide a range of Excel versions as possible. That is why they all mention that the API will handle files that are based upon a specific version of Excel. Hopefully, you will be fine distributing the application onto machines that run earlier versions of Excel.
By the way, have you also considered JExcel? It handles a few things differently to HSSF (POI) and you may prefer the way it approaches parsing an Excel spreadsheet file and exposing it's contents. -
Jakarta-poi-1.5.0-FINAL-20020506.jar
Where do I download jakarta-poi-1.5.0-FINAL-20020506.jar from ???
Can anybody help me ???Hi Friends,
I'm also on the same track. I download the jw-0332-poi from Resources of http://www.javaworld.com/javaworld/jw-03-2004/jw-0322-poi.html
I compile CreateXL.java & ReadXL.java files & got compilation errors like:
"cannot resoleve symbol class HSSFWorkbook
"Cannot reslove symbol class HSSFSheet"
and more error for HSSF package from org.apache.poi
To solve this I download "poi-bin-3.0-Final-20070503.zip" from http://www.apache.org/dist/jakarta/poi/release/bin/
and poi-src-3.0.1-FINAL-20070705.zip files fromApache download mirrors. i put it in classpath & then compile but still I got the same error.
I didn't find jakarta-poi-1.5.0-FINAL-20020506.jar on http://www.apache.org/dist/jakarta/poi/release/bin/
From where should I get the jakarta-poi-1.5.0-FINAL-20020506.jar ?
I would appreciate your help for this topic. -
Hello techies,
I want read an Excel sheet using Java. I had gone through net and found two Api's.
One is Jakarta's POI and another one is JExcel.
Iam totally confused, which one i need to implement and is there any performance difference b/w these two api's.
Also can any body tell me from which url i have to download these two s/w and how to install them.
regards,
ramuOne is Jakarta's POI and another one is JExcel.
Iam totally confused, which one i need to
e i need to implement and is there any performance
difference b/w these two api's.Don't know, i'm sure a google would tell you.
e.g 1
2
Also can any body tell me from which url i
which url i have to download these two s/w and how to
install them.I'm suprised you found out about the libs, but not the download URLs Google Jakarta POI and: First Hit!... -
Hi All
I have a requirement to create a web application that interfaces with microsoft com.
I have searched through the forum and the Jakarta poi looks like a good option.
My question is, has anyone integrated jakarta poi with adf and deployed the app to the web application server.
I am using Jdeveloper 10.1.2.
Has anyone done a mail merge ?
Thank youAnother reference:
http://technology.amis.nl/blog/?p=450 -
I am using a servlet to create an xls file using Jakarta-POI.Rt now i am saving the file to the server,then copy to the client s/m which accesses the servlet
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("export");
FileOutputStream fileOut = new FileOutputStream("test.xls");
wb.write(fileOut);
fileOut.close();
This code directly saves the file to the server.
Can i write the workbook directly to client's s/m using any buffering?
bcoz my boss told me this will create sme security issues .....
Anybody plz help me..
Thanks in advanceDon't a different stream, like the servlets output stream?!
-
Problems in Using Jakarta POI in Jserv- NoClassDefFound
Hi,
I'm trying to deploy an application on Jserv which used the Jakarta's POI API. I placed the Jar file in the server folders and specified the same path in the file Jserv.properties.
But then when trying to access that folder it gives the error NoClassDefFound for the poi's packages meaning its not picking up the classes under this jar.
I restarted the Jserv several times after mentioning the path.
Can anybody help me on this in pointing out wat i have missed here.
Thanks in advance,
Vijayhello,
i'm also having problems using poi. I've copied the poi jar to tomcat/lib and also to the lib directory of the systems jdk. I've done the same with the commoms-logging.jar.
Within a jsp is import these things:
<code>
<%@ page
buffer="128"
import="java.util.*,
org.apache.poi.hssf.usermodel.*,
org.apache.poi.hssf.util.*"
%>
</code>
But when calling the url of the page i get:
Package org.apache.poi.hssf.usermodel not found in import.
Why, it is in the import? Whats wrong there?
Thank you,
Hava a nice day,
Nico -
The problem is that when i open the XLS file that I create using POI the DATE Cells are not formatted as DATE Cells and the code is well.
It's
private void llenarFila(ResultSet rs, HSSFRow row, HSSFWorkbook wb) throws SQLException {
ResultSetMetaData rsmd = rs.getMetaData();
//DateFormat df = DateFormat.getDateInstance();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
HSSFDataFormat format = wb.createDataFormat();
SimpleDateFormat formatter2 = new SimpleDateFormat("dd/MM/yyyy", new Locale("es"));
//DateFormat formatter2 = DateFormat.getInstance();
for(int i = 1 ; i <= rsmd.getColumnCount() ; i++) {
int columnDataType = rsmd.getColumnType(i);
System.out.println(columnDataType);
HSSFCell cell = row.createCell((short) (i-1)); if(columnDataType == 93) { // java.sql.Types.DATE y oracle.jdbc.driver.OracleTypes.DATE son 91 y no funcionan... de la basde devuelve 93 para DATE
try {
Object obj = rs.getObject(i);
if(obj != null) {
String dateString = ((Object)rs.getObject(i)).toString();
java.util.Date date1 = formatter.parse(dateString);
String newDateString = formatter2.format(date1);
System.out.println(date1.toString());
java.util.Date date = formatter2.parse(newDateString);
System.out.println(date.toString());
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setDataFormat(format.getFormat("dd/mm/yyyy"));
cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
cell.setCellStyle(cellStyle);
cell.setCellValue(date);
//.... the rest...
}Any ideas ? Thanks a lot. This is going me crazy since yesterdya.I've not used POI, but this might be helpful for you:
http://jakarta.apache.org/poi/hssf/quick-guide.html#CreateDateCells
http://linux.com.hk/docs/poi/org/apache/poi/hssf/usermodel/HSSFDateUtil.html
Good luck
Lee -
All
I'm from Japan. My English is very poor and sorry.
I want to operate Excel Spread sheet on Java program. I found out an information for excel spread sheet operation on Java program by using API's POI or JEXCEL.
But I have no idea which is better. Please advice me the following topics.
1,What's different POI and JEXCEL?
2,What's merit and demerit POI and JEXCEL?
My environments are
1,Applicatoin Server :Websphere
2,Programing Language: Java
3,Database UDB in Z-os(MainFrame)
My requirements are
1,I want to pick up data from database, and create excel spread sheet on application server, and down load excel spread sheet to client.
2,I want to update data to database created by excel spread sheets on client.
Please advice.
ThanksTechnicalDoubts wrote:
Apache POI vs JExcel
5.POI do not provide password capability for the spreadsheet.
6.POI consumes lot of heap memory when we write data to excel sheet which causes outofmemory error.JExcelAPI also does not offer support for passwording a spreadsheet. Even if it did, breaking the password on a spreadsheet only takes seconds with the right tool.
JExcelAPI, until recent versions, has been known to consume memory as well. Changes have been made to the code which greatly improves it's memory usage.
Having used JExcelAPI for nearly 3 years now I would highly recommend using it. Here are some links to help:
http://jexcelapi.sourceforge.net/resources/faq/
http://tech.groups.yahoo.com/group/JExcelApi/
The forum is active as well, myself and others are always there to help. -
Jakarta POI and Java Excel API
I recently downloaded both these as I'm trying to create an application that reads information from an excel file. However, the problem I am having is that I just don't know where to start. When I download the files and unzip them, I haven't a clue where to put the files or how to call them from my java files. I've read the help files on both the websites but am no clearer on what to do. Any help would be much appreciated.
Download an IDE like Eclipse or JBuilder. Set-up the POI or JExcel JAR files on your new project's class path. Import the relevant packages into the class that will use them. Start typing, autocomplete will help give you a list of classes and methods that are available.
If the above is confusing, start over. Go back and re-read how to import external JAR's onto a classpath. Try to use another third-party API to get the hang of it. Then, do it with POI. Follow the examples, even copy-paste a class into your own source tree and try to compile. Gradually, build up your expertise. Now, go to the Javadocs. You should have the ability to use any class or method published in the API.
- Saish
Maybe you are looking for
-
For the safari, it is just a blank white page everytime I open it.
-
We have Oracle9i, i have seen about synonym. I have some doubts... 1. Is that we can create synonym for objects like Packages, stored procedures,views and Functions. 2. How Synonyms helpful in user privileges?. 3. What is Public and Private Synonyms?
-
I've created a print action using images that have descriptions and I include the description along with the label when printing. Every image printed after the action is created prints with the same description as the initial one. The label changes
-
Social Networks / Communities / Facebook , Twitter...
Hello, There was recently an update for the communities app on my C7, before the update, the widget displayed some facebook details by default aswell as the profile pic, and it had to little buttons to go up and down to scroll through to twitter or f
-
Hi All I developed Web Dynpro application and trying to call adobe form and send it to Printer. For this I am clciking one button in UI. I have called following FM's to call ADOBE in the above button action. CALL FUNCTION 'FP_FUNCTION_MODULE_NAME', C