Read form data from doc or rtf file with java - java

i have a word document with a form that is filled by users and , after that, it is saved. I would like to access form field data from a Java application in order to automatize some business process.
I have tested Apache POI but it is unabled to access form elements.
Is there some api to access form element data with java?

You can use: Class FFDataBaseAbstractType (org.apache.poi.hwpf.model.types).
The FFData structure specifies form field data for a text box, check box, or drop-down list box.

You may try Aspose.Words for Java which allows you to access form fields and data in Java applications. The API is quite simple and easy to use. The component is a simple Jar file which is easy to deploy with your application. Also note that you do not need to install MS Word in order to use this component. Please see if this might help in your scenario.
Disclosure: I work as developer evangelist at Aspose.

Related

Adding buttons, textfields, checkboxes etc. to an OpenOffice textdocument usind UNO with Java

I am trying to create a OpenOffice document using the UNO-API with Java.
I am already able to create a simple document and put some simple text into it.
What I want to do, i.e. need to do, is add also Forms (TextFields, CheckButtons, Push(Click)Buttons) into it.
The idea is to create a form in openoffice which in the end can be transformed to a PDF with interactive pdf-forms.
I am able of creating these with iText and manually with OpenOffice.
But I have not found a (simple or any) Example of creating such objects with the UNO-API.
So any help, hints or links (not that I haven't tried to find something via google, but maybe I just used the wrong key-words) is appreciated.
An alternative for you might be to use the ODF Toolkit, with its Java APIs for manipulating ODF documents, the native format of OpenOffice.org and its descendants.
I don't know if ODF Toolkit supports the features you are interested in though. Check at http://incubator.apache.org/odftoolkit/

Struts search application within website of without database

i'm new to java struts.
actly i want to create an application in which i want to search within the website static pages,which has no database. i.e. if user enter the search string then the corresponding results are shown to user.
You should probably start with a Struts tutorial (http://j2ee.masslight.com/Chapter4.html for example) to get the bones of your application up and running, namely your textbox and button.
Struts is an MVC framework with a 'M'. By that I mean the implemention of your model is completely up to you. So when it comes time to write your Action class you can do anything you want. From the sounds of it you want parse an HTML file so you can either load it using java.io if it's stored on the server or load it from where ever.
It depends on your definition of a 'database'. There are some good search engines out there (like Lucene) that can index your html and store this in an index file on your file system. The semantics come in on whether you believe this index is a 'database' or not.
Most of the search engines come with an HTML crawler and parser out-of-the-box so your requirement to have something search through your content (especially when it is not publicly available to be indexed by the likes of Google), should not be insurmountable.

simple cms - only to create/edit content and export it via jdbc or java api

(i even don't know if i need a cms)
what i need is: a simple web based way for a functional department to create/edit multilingual text documents (probably tagged with customizable semantic tags).
The containing Texts are used in an RIA showing statistical data and infos about it. This infos and other user visible Stings should be fully managed by functional department.
the destination of the this texts/documents is an embedded apache derby db - delivered together with RIA release (as zip-File,- the texts are static).
So on the other hand the cms (if this is an cms) should provide an interface to export the data - either a simple db-structure to get data via jdbc or a java api.
so what cmc/?? do you suggest for this usecase
thx in advance
Maybe you could use a java web framework like Tapestry to create a simple web application.
It has some premade components too easily modify and save data to a database.

populate data from java to pdf

I am currently looking for a solution to populate a PDF file from the java code, Is there any APi for that, I googled it and found JustformsPDF does the trick, but it works only for some pdf and not all + its a old API without recent developments/support.
Basically I have an existing PDF (and do not want to build it) I just need to populate my java data inside that pdf.
any suggestions ?
These two should be able to do the job (these are the ones I know, there may be more):
Apache PDFBox
iText
You can use our product PDFOne (for Java). It has a document component that can also fill form fields in existing PDF documents. Viewer and printer components are also available.

Clientside Javascript --> Serverside Java --> user is served a .doc

I am helping someone out with a javascript-based web app (even though I know next to nothing about web development) and we are unsure about the best way to implement a feature we'd like to have.
Basically, the user will be using our tool to view all kinds of boring data in tables, columns, etc. via javascript. We want to implement a feature where the user can click a button or link that then allows the user to download the displayed data in a .doc file.
Our basic idea so far is something like:
call a Java function on the server with the desired data passed in as a String when the link is clicked
generate the .doc file on the server
automatically "open" a link to the file in the client's browser to initiate the download
Is this possible? If so, is it feasible? Or, can you recommend a better solution?
edit: the data does not reside on the server; rather, it is queried from a SQL database
Yep, its possible. Your saviour is the Apache POI library. Its HWPF library will help you generate Microsoft word files using java. The rest is just clever use of HTTP.
Your basic idea sounds a bit Rube-Goldbergesque.
Is the data you want in the document present on the server? If so, then all you need to do is display a plain HTML link with GET parameters that describes the data (i.e. data for customer X from date A to date B). The link will be handled on the server by a Servlet that gets the data and produces the .DOC file as its output to be downloaded by the browser - a very simple one-step process that doesn't even involve any JavaScript.
Passing large amount data as GET/POST around might not be the best idea. You could just pass in the same parameters you used to generate the HTML page earlier. You don't even need to use 3rd party library to generate DOC. You could just generate a plain old HTML file with DOC extension and Word will be happy to open it.
Sounds like Docmosis Java library could help - check out theonline demo since shows it something similar to what you're asking - generating a real doc file from a web site based on selections in the web page. Docmosis can query from databases and run pretty much anywhere.

Categories