easy-template-x icon indicating copy to clipboard operation
easy-template-x copied to clipboard

Is it possible to add column in the table dynamically ?

Open DVGY opened this issue 5 years ago • 5 comments

DVGY avatar Nov 17 '20 09:11 DVGY

Unfortunately no, this is not currently supported.

alonrbar avatar Nov 18 '20 19:11 alonrbar

For future reference if you, or anyone else, want to implement this (and even better, send a PR) this is a good place to start:

  • The existing "loop strategy" that creates table rows dynamically - https://github.com/alonrbar/easy-template-x/blob/master/src/plugins/loop/strategy/loopTableStrategy.ts
  • Word table XML structure overview - http://officeopenxml.com/WPtable.php

alonrbar avatar Nov 18 '20 19:11 alonrbar

@DVGY could you please provide a sample docx and describe the way you want it to be?

hydra1983 avatar Dec 21 '20 12:12 hydra1983

@hydra1983 Just jumping in here sorry, but adding to this topic- we are currently using docx-templates & the only real issue we have is the lack of dynamic columns. i.e taking the same iteration as for rows, but, generating columns based on array length (fixed number of rows, in our case).

KAVA-Leigh avatar Feb 04 '21 11:02 KAVA-Leigh

I am not sure I understand the use case completely, but if there are a limited number of schemas, you can define separate tables and have them in different tag names. Only output the correct one. Works for my use case. Again, may not help but it is an idea

aylabbs avatar Mar 18 '21 17:03 aylabbs