Reading word template user entered values in java - java

I have a word template for a application Form (which contains text, dropdowns, checkboxes, date fields..). In my web application whenever user starts a new process they need to fill some high level data, here I need to fill some of the user entered data into the word template and let user download that document. Later user takes this document offline and fills empty lower level fields in that document, whenever they are done filling they will upload the document back into the application. Now I need to read the values of each field that user entered and store those values in Database.
Can someone give me the direction how to achieve this using java.
Or is there a better way to achieve the same with other than the word templates.
-----------------Update---------
Planning to use docx4j library. Following are the higher level steps that I may follow for my process
Creating a word template using locked content controls
A unique tag value (w:tag) will be assigned for each content control
Will populate any dropdown values and any other controls values using
docx4j library.
After user fills the form, will extract data from template using
docx4j, considering the unique tag value that I assigned in first
step.

The Apache OpenOffice API (based on the UNO component technology) allows you to read and manipulate OpenOffice documents. To .doc (not based on xml) formats you can use de API to convert the file to ODT, what turn you enabled to extract and process the data within the document.

Related

IBM Notes field limitation, option to store data as rich text?

In an application I am experiencing problems with field limitations.
At the moment I am using a multiline edit box control on an xpage to capture the information and I save it in the back-end on the Notes document as a text field e.g:
doc.replaceItemValue("emplInformation", employee.getInfo());
I was not aware that users paste "complete stories" in the field so it breaks my functionality (I am not handling the error so the document will never be stored).
Therefor I was thinking that instead, perhaps I could save the information to a rich text field instead and hereby avoid the field limitation.
Is this a smart thing to do? Or, should I try other options?.
I have to mention that the user is not going to enter formatted text (yet). So I do not have to take notice of that. Nor that they will paste in images or html.
I have never worked with rich text or mime in Java before so I am not experienced in read/write such data. Any code example how to store it to the back-end document is highly appreciated.
If you want to store data in a field, was could be greater as the field limit, you may consider using the OpenNTF Domino API.
You can store in a single field, if to big, the field is automatically converted to a RichText item.
Is used it in our HR Assistant application, for info about to bypass the limit see, http://elstarit.nl/2018/01/18/make-the-nsf-modern-again-with-openntf-domino-api/

Creating pdfs from predefined templates in java

My Spring application needs to create different types of PDF documents like invoices and certificates each having dynamic data .I would like to have some predefined templates(html/text file) from which I can generate the full PDF content. The predefined template holds the full content of the PDF document including the font size, alignments of each section etc and also have key values that need to be replaced with actual values form database. I know it is easy to create PDFs from html. Is anyone having any idea on how to accept an html template as input in a java program and then hook in the keys defined in it with actual values and finally creating the PDFs?

Make existing PDF's in to templets - iText

I am trying to make some existing PDF's into templets.
Because these documents hold real data I am replaceing this data such as names and addrsss and making them into dummy place holders.
Examples
[[Name]]
[[Address1]]
When I alter the text via the iText version 5 library replace via a program I can use the template.
To speed things up I tried to use Adobe DC.
When using this method the template stops working.
Any ideas?
From what I understand of your question;
you have (or want to have) a template document
fill in the template with data from a program
turn this back into a pdf
You can easily achieve some of your goals with iText.
I suggest you look into http://developers.itextpdf.com/examples/form-examples/clone-filling-out-forms

How to manipulate a Check box in Word with Java and save as PDF?

I need to edit some Check-Boxes in a big Wordfile (docx) and save this then as PDF. This file contains many images and is about 19MB big.
Maybe there will be the need of adding some Checkbox and text.
My idea was to use docx4j, but before to learn the ropes I want to ask if this is possible and which is the best way.
May it be better to save the document as a PDF and then use this as base for processing?
Yes, you can manipulate checkboxes using docx4j.
Be aware that there are several different kinds of checkboxes:
legacy checkbox
content control checkbox
checkbox character
and the details depend on which type are present.
For more, you should post a snippet of the relevant OpenXML (and as they say here on SO, code showing what you've tried).
Is it necessary to use only docx4j?
Recently i tried a solution that helps me manage a Word document with checkboxes and save it as a PDF file. I used Plumsail Documents. The case is about how to populate a Word template using a form with checkboxes. You can connect your app via Zapier or Power Automate to activate checkboxes depending on value from your app. You can set the resulting file as a PDF and deliver it by email and across any system using Zapier and Power Automate.
The great is that Plumsail Documents has a templating engine that allows it to operate pictures.
Your case may be like this:
Create a form in Plumsail Form. It will allow you to activate checkboxes depending on your needs, or your users' needs.
Create a process in Plumsail Documents, upload your Word document and set it as a template. Just put placeholders where you want to change or fill a document with some values or data. Set the resulting document in PDF format.
Set the delivery method. Save across apps or deliver by email.
I recommend you to read the article. That solution is not free, but there is a free 30-day trial, so you will have enough time to try it.

What is the best format to use when creating a mail list for use in a Word 2007?

I'm writing a web app (Java) which allows users to select contacts. The contacts details can be downloaded (currently in CSV format) and used to perform a mail merge in Word 2007.
I would like to use a format which is a bit more 'robust' than CSV. Those of you in non-English areas will know the comma/semicolon problems!
Which format would you use?
I prefer TSV (Tab Separated Values) for this sort of task. I have never encountered a dataset containing literal tabs that were desired in the output.
Not having much experience in "non-English" mail merges, what's wrong with exporting the contacts in xlsx format and using that as your datasource?
Depending on the reasons you have your user doing the mail-merge, you could consider moving all the work to the server side. When the user selects the contacts and clicks ok, get the server to mail-merge and create the doc for the user and send it to them. Docmosis or JODReports can provide this capability. You could also allow the user to select different templates or if you are really generous, let the users upload their own.

Categories

Resources