Forms In MS Word

Quick Guide >>

Printing through MS Word

Note : This feature is deprecated,use Fast Reports instead.

You can create free form reports with this option. A print format can be made in MS Word with tags for placing data in the document.

The MS Word feature in print forms is used to embed data from a transaction into a MS Word file. The Print Form functionality is a part of the TStruct Definition.

Steps to create a new MS Word print format

 Step 01 : 

– Create a word document with the data fields that need to be pasted onto the document as ~fieldname. The fieldname should be a valid field from the tstruct. Arrange the fieldnames in the format as needed. All fieldname should be formatted within a word Table. If you don’t want the borders to be previewed / print, the table borders can be set invisible.

If the Grid or SQL result consists of three columns named col1, col2, col3, create a table in MS Word as shown below.

Column Heading 1 Column Heading 2 Column Heading 3
~col1 ~col2

~col3

~col1 ~col2

~col3

~col1 ~col2

~col3

~#col3

–       In case all the rows in the Grid or SQL result should be printed before proceeding further, then check the Auto Grow property. In this case, the table format should be as follows:

Column Heading 1 Column Heading 2 Column Heading 3
~col1 ~col2

~col3

–       Save the file with .doc extension. –       On execution, the above table will be replaced with values from first three rows in the SQL result/Grid. The last line in the table will print the total of the values in that column. If there are more rows in the SQL result, then a new page will be added and the rest of the rows are printed. Before adding the new page, the values of the rest of tags in the same page will be replaced. This kind of a feature can be useful to print on preprinted stationary.

Step 02: Select the TStruct in build mode and Click the <Print Form> button from the Tstruct Tool Bar

Step 03: Choose the option MS Word File from the menu and click the New button.

Step 04: A window will pop up. From the window click the Browse button to open the word document you have created. Click the Apply button and close the window.

Other options

  • Auto Grow: If the contains a table where the rows dynamically add from a Grid DC or SQL result, the property has to be checked.
  • Show Print Dialog: Check this option if the print dialogue box to be popped up at the time of opening the document on click of a button
  • Default Decimal: Specify the number of decimals to be rounded off and displayed if the document has a numeric field
  • Grid Tables: Each table in MS Word has a unique serial number starting from 1. If there are three tables in the template and the first table is populated from SQL/Grid then set the Grid Tables property for the Print Form as 1. If more than one table prints results from different Grids or SQL statements, then the table numbers can be comma separated. For instance, Grid Tables property could be 3, 4 if the third and the fourth tables are being used for Grid/SQL results.
  • Grid Table that starts in new page: If a table needs to print on a new page, the Grid number has to be specified. This is only applicable the Auto grow property the enabled.
  • Page Head Table: If a table needs to be print on every page, the Grid number has to be specified. This is only applicable the Auto grow property the enabled.
  • Data Source: If the data needs to be printed from different forms/tables, SQL have defined to fetch to the data from the relevant tables. The columns name will be used as the variables in the print format. Note the columns names should unique.