Using JAVA to extract Microsoft Word Form Field Data - java

I am using Doc4j and try to extract msword form data.
It can be easily do with VBA http://gregmaxey.mvps.org/word_tip_pages/extract_batch_form_data.html
I am using FieldRef to extract the MSWord docx form field data.
I can get the field name, and just the first line of data in the text fields, but it cannot extract the form field data with more than one line.
I cannot find similar solution from POI too.
Here is the sample data
http://www.docx4java.org/forums/docx-java-f6/form-field-extraction-t2078.html?sid=7b4cd3ba2ba947ebbe186ad7df88b2fc
Thanks,
Cyrus Wong

Related

Is there a way to mark metadata as read only in Excel

We have a use case to generate Read-Only(such as the document Creation date or Number of characters) metadata for Msexcel file.
But whatever metadata we generate using java(apache poi) is editable.
I tried adding metadata in custom , but this also editable .
Can some one hel me out in finding a way to mark part of metadata as readonly in excel file

Read multiple csv file with CsvJdbc

I need to bind a group of csv file in the format "YYYY-MM-DD hh:mm:ss.csv" that are present in the same folder with a unique table that contains all the data present in all the files.
I need to read the data from a Java EE application thus I would like to create a connection pool inside the application server. I found the CsvJdbc driver that allows the reading of multiple files as a single entity. A good starting point was this page in the section with this paragraph:
To read several files (for example, daily log files) as a single table, set the database connection property indexedFiles. The following example demonstrates how to do this.
The example could be fine for me but the problem is that I do not have a header word in the filename string. So the corresponding table becames an empty string that makes obviously impossible to query the table.
How can I tell the driver to map the pattern to a table that hasn't a header part?
P.S. I already tried to use hsqldb as a frontend to the csv files but it does not support multiple files.
Setup CsvJdbc to read several files as described in http://csvjdbc.sourceforge.net/doc.html and then use an empty table name in the SQL query because your CSV filenames do not have any header before the fileTailPattern regular expression. For example:
props.put("fileTailPattern", "(\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)");
props.put("fileTailParts", "Year,Month,Day,Hour,Minutes,Seconds");
...
ResultSet results = stmt.executeQuery("SELECT * FROM \"\" AS T1");

Convert String field to delimited file (.csv)

I have a mysql table that has a column with the type longtext, this column containt the content of a csv file. Is there a way to create from the content of this column a csv file and extract data from it by using talend ?
You could extract the String from the DB using the proper Input component. Then use tExtractDelimitedField to split this long String string against a separator character (the comma, I guess). Don't forget to specify carefully your output schema
Finally, use tFileDelimitedOut to write the delimited file with data from the outgoing connection on the file system.
This could help: Validate a csv file
Sure, request the string out of the database, open a file and write the string to it - where's your actual problem?

Is there any method to read table rows in doc file by using java?

How should I read tables in doc file by using java. In my doc document there is a large table and I wanna seperate this table row by row.
Is there any method to read table rows in doc file by using java??
Take a look at Apache POI library. POI helps extracting metadata as well as content fron all Microsoft Office documents and Open Office documents.

insert Xml file data into MySQL table

I want to insert the Xml file data into MySQL table ,, by choosing which column to insert into ,, using Java How will this be done ?
It really depends on the format of your XML file. If your XML file is a direct export from the MySQL file, please refer to this question.
If your XML is in some other format, then I would probably be using JAXB to parse XML into POJO, then write some logic to map the POJO into the database table.

Categories