We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Conditionally add/remove columns from a table in word template

Hello,


I have a requirement whereby the table columns changes based on the type of the list items displayed. For some types of list items, 4 columns needs to be displayed and for some, 6 columns needs to be displayed. I cannot have all 6 columns displayed all the times and data in 2 of them appearing blank.

How can this be implemented?

Also, how to insert a line break in the string for the data displayed in merge field? e.g.
firstName + “\n”+ lastName.

Thanks for your time and help.

Hiren

Hi Hiren,

Thanks for your inquiry. It would be great if you please share following detail for our reference.


  • Please attach your input Word document.
  • Please share some more detail about your scenario.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated
    like.

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

I have exactly the same problem with my Aspose Word templates: sometimes my table has 5 columns, sometimes 4.

I would like to know if it is possible to remove a column from an existing Word template.

Regards,
Frank

Hi Frank,

Thanks for your inquiry. Please note that a table in MS Word is a set
of independent rows. Each row has a set of cells independent on cells
of other rows. So there is no logical “column” in a MS Word’s table.
“The 1st column” is something like “a set of the 1st cells of each row
in a table”.

There is no APIs to work with table’s columns.
However, you can work with columns using the workaround shared in
following documentation link. Hope this helps you.
http://www.aspose.com/docs/display/wordsjava/Working+with+Columns