0 votes

For one of our client I need to format a template via runScript. on my script I have 4 columns and few lines. I want to return these data in a table each columns in a cell and each line in a row, but I get all lines in one cell for each columns.

How can i get this working

Ps: the goal for the client is that each row will be separated by a horizontal line


asked in Partners by (182 points)
What format is your template?
My template is a word document standard (not html)
Is that DOCX, DOC or RTF?
My template is a DOCX format

1 Answer

0 votes

You should work with a detail table, it allows you to loop through the details that are available in your merge context. Since you are working with DOCX, your merge context is the document handle.

The typical details that are used in a template are Companies, Contacts and Products. Follow the instruction here on how to insert a product table. Make sure you have linked products on your document :-)

But instead of the legacy [$GetRtfTable('PROD')] [/$] use [$GetTable('PROD')] [/$]

Follow the guide very carefully and built up step by step. One space is enough to brake it.

answered by (6.9k points)
Sorry but for my needs I can't use this way, because here is my selection:
var SQLQuery =  "select " +
                    "C.NAME, C.FIRSTNAME, isnull(C.BIRTHDAY,'') as BIRTHDAY, isnull(EU.F_DIVLIB_FR,'') as JOBTITLE, isnull(EU.F_DIVLIB,'') as JOBTITLEen " +
                    "from <#TABLE NAME=DOCUMENTS> D " +
                    "   inner join <#TABLE NAME=TRAI_DOCU> TD on TD.K_DOCUMENT = D.K_DOCUMENT " +
                    "   inner join <#TABLE NAME=DOCU_COMP> DC on DC.K_DOCUMENT = D.K_DOCUMENT " +
                    "   inner join <#TABLE NAME=CONT_COMP> CC on CC.K_COMPANY = DC.K_COMPANY " +
                    "   inner join <#TABLE NAME=TRAI_CONT> TC on TC.K_TRAINING = TD.K_TRAINING and TC.K_CONTACT = CC.K_CONTACT " +
                    "   inner join <#TABLE NAME=CONTACTS> C on C.K_CONTACT = CC.K_CONTACT " +
                    "   left join <#TABLE NAME=LK_ERP_UFON> EU on EU.K_ERP_UFON = C.F_JOBTITLE " +
                    "where 1 = 1 " +
                    "   and D.K_DOCUMENT = :PARAM1 " +
                    "order by C.K_CONTACT";

which is not part of docu_cont but just in contact so for that I use a runscript
Welcome to Efficy Overflow, where you can ask questions and receive answers from other members of the community.
1,169 questions
1,427 answers
325 users