Page 1 of 1

How to modify the Table column order in an existing Table

PostPosted: Wed Apr 16, 2014 5:24 pm
by abhradeep_kundu
I want to re-order the column of an existing docx table using docx4j. Is there a simple way?

Re: How to modify the Table column order in an existing Tabl

PostPosted: Wed Apr 16, 2014 10:49 pm
by jason
It is fairly straightforward if you don't have any merged cells (especially horizontal merge).

If you do have those, maybe it worth looking at using docx4j's AbstractTableWriterModel

Re: How to modify the Table column order in an existing Tabl

PostPosted: Thu Apr 17, 2014 1:31 am
by abhradeep_kundu
Thanks for quick reply I will look at the class and let you know if I find it difficult to get

Re: How to modify the Table column order in an existing Tabl

PostPosted: Thu Apr 17, 2014 3:44 pm
by abhradeep_kundu
Hi Jason,

Not able to get the idea how to re-order columns in existing docx. Can you please give me a code snippet or any reference?

What I want is ->
Suppose I have a table with A, B, C columns in respective order
A | B | C
-------------

Now what I want is to make it A | C | B or A | B like this in runtime

Regards,
Abhradeep

Re: How to modify the Table column order in an existing Tabl

PostPosted: Thu Apr 17, 2014 6:40 pm
by jason
Your starting point should be to have a look at the XML representing a table (by unzipping a docx, or uploading it to the webapp), and then understanding the corresponding org.docx4j.wml package objects.