Page 1 of 1

How to identify a table uniquely among many tables in a docx

PostPosted: Sun Nov 09, 2014 5:48 am
by vtikariha
Hi,

I have a docx file having many tables. I have to populate data in these tables from database. My problem is how can i identify a table uniquely programmatically using docx4j and populate it with corresponding data from database. Is there any property which helps to identify a table uniquely among many tables in a docx file?
I have attached the sample file for reference.

Re: How to identify a table uniquely among many tables in a

PostPosted: Tue Nov 11, 2014 1:24 pm
by jason
You can use tblCaption; see further http://stackoverflow.com/questions/1777 ... osoft-word

Alternatively, you can wrap each table in a rich text content control, and use w:tag to identify them.

For row level id, you can use @w14:paraId; see further [MS-DOCX] spec

Re: How to identify a table uniquely among many tables in a

PostPosted: Thu Mar 19, 2015 6:14 pm
by jimka
I'm trying to do the same thing, but unless I'm missing something, tblCaption isn't exposed by Docx4j. Can you provide some code on how to locate this node?

Re: How to identify a table uniquely among many tables in a

PostPosted: Thu Apr 02, 2015 1:46 am
by jimka
I patched the source myself to add support for the caption and description fields, seems to work as far as I've tested.


See the attached file for what I did to make things cooperate.