Difference between revisions of "Including Tables in a Word Merge Document"

From SmartWiki
Jump to: navigation, search
(all fixes applied)
 
(7 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
* Tables should be included at the very end of the '''Values''' section.
 
* Tables should be included at the very end of the '''Values''' section.
 
* The table you create in MS Word for the example above would look like this:
 
* The table you create in MS Word for the example above would look like this:
[[Image:WordTable.PNG]]
+
[[Image:WordTable.PNG|link=]]
  
 
===Using Object [#...#]  syntax===
 
===Using Object [#...#]  syntax===
* Used to pull in list of activities, contacts, users, companies, notes, associations, transactions, level-1, utaproviderL1, utaproviderL2, utaconsumerL1 or utacomsumerL2 into the Word Merge document.
+
* Used to pull in list of activities, contacts, users, companies, notes, associations, transactions, level-1, utaproviderL1, utaproviderL2, utaconsumerL1 or utaconsumerL2 into the Word Merge document.
 
:''For example: to include all Level 2 Activities related to a Level 1 entity you could use'':
 
:''For example: to include all Level 2 Activities related to a Level 1 entity you could use'':
  table_1=[#(?object=activity)|~description~|~statusname~|~startdate~|~enddate~|$1139409$|#];
+
  table_1=[#(?object=activity)|~description~|~statusname~|~startdate~|~enddate~|$Another Field Name$|#];
 
* Be sure there are no spaces between the pipes (|) and variables.
 
* Be sure there are no spaces between the pipes (|) and variables.
 
* In the example below the first table (identified by position and referenced as table_1) is set to the records associated with the [[Entity|entity]].
 
* In the example below the first table (identified by position and referenced as table_1) is set to the records associated with the [[Entity|entity]].
[[Image:WordMergeTable.PNG]]
+
[[Image:WordMergeTable.PNG|link=]]
 +
 
 +
===HTML Tables===
 +
Instead of creating a table in the MS Word Merge document, you can define HTML on the MS Word Merge field that will be used to create a table in a normal bookmark on the MS Word Merge document.<br />
 +
When defining a HTML table do not use CSS rules as they will not work. Use the old way HTML 4 table tag syntax formatting.<br />
 +
w3schools: HTML <table> Tags list: http://www.w3schools.com/tags/tag_table.asp<br /><br />
 +
 
 +
 
 +
To format text inside a table also use HTML tags like: B, I, U, FONT.<br />
 +
w3schools: HTML Text Formatting Elements: http://www.w3schools.com/html/html_formatting.asp<br />
 +
w3schools: HTML <font> size Attribute: http://www.w3schools.com/tags/att_font_size.asp<br /><br />
 +
* Example:
 +
<pre>
 +
bookmarkname=<html>
 +
<table width="100%" border="1" cellspacing="0" cellpadding="3">
 +
  <tr>
 +
    <th>#</th>
 +
    <th>Date</th>
 +
    <th>Details</th>
 +
  </tr>
 +
[#(?object=activity)
 +
  <tr>
 +
    <td width="10%" align="right">~Index~</td>
 +
    <td width="40%"><!--@sscalculation(DATE_FORMAT("~startdate~","%d %M %Y"))--></td>
 +
    <td width="50%">$Activity Details$</td>
 +
  </tr>
 +
#]
 +
</table>
 +
</html>;
 +
</pre>
  
 
==See Also==
 
==See Also==
 
{{WordMergeLinks}}
 
{{WordMergeLinks}}

Latest revision as of 08:30, 26 April 2015

You can also add data to one or more existing tables in the resultant MS Word document if you have multiple records that you need to include.

  • In the MS Word document you must create a table with the relevant number of columns. The table should only include a single row with the column headings (the heading do not have to match the field names within SmartSimple.)
  • You do not have to create form fields within the table. New rows will be created automatically and populated with data in the order specified in in the MS Word Merge Custom Field Values section.
  • Tables should be included at the very end of the Values section.
  • The table you create in MS Word for the example above would look like this:

WordTable.PNG

Using Object [#...#] syntax

  • Used to pull in list of activities, contacts, users, companies, notes, associations, transactions, level-1, utaproviderL1, utaproviderL2, utaconsumerL1 or utaconsumerL2 into the Word Merge document.
For example: to include all Level 2 Activities related to a Level 1 entity you could use:
table_1=[#(?object=activity)|~description~|~statusname~|~startdate~|~enddate~|$Another Field Name$|#];
  • Be sure there are no spaces between the pipes (|) and variables.
  • In the example below the first table (identified by position and referenced as table_1) is set to the records associated with the entity.

WordMergeTable.PNG

HTML Tables

Instead of creating a table in the MS Word Merge document, you can define HTML on the MS Word Merge field that will be used to create a table in a normal bookmark on the MS Word Merge document.
When defining a HTML table do not use CSS rules as they will not work. Use the old way HTML 4 table tag syntax formatting.

w3schools: HTML Tags list: http://www.w3schools.com/tags/tag_table.asp

To format text inside a table also use HTML tags like: B, I, U, FONT.
w3schools: HTML Text Formatting Elements: http://www.w3schools.com/html/html_formatting.asp
w3schools: HTML size Attribute: http://www.w3schools.com/tags/att_font_size.asp

  • Example:
bookmarkname=<html>
<table width="100%" border="1" cellspacing="0" cellpadding="3">
  <tr>
    <th>#</th>
    <th>Date</th>
    <th>Details</th>
  </tr>
[#(?object=activity)
  <tr>
    <td width="10%" align="right">~Index~</td>
    <td width="40%"><!--@sscalculation(DATE_FORMAT("~startdate~","%d %M %Y"))--></td>
    <td width="50%">$Activity Details$</td>
  </tr>
#]
</table>
</html>;

See Also

To set up a Word merge:

Advanced Word Merge Features Include: