Detailed design of printing templates in Word/Excel format
This article describes more details about printing templates in Word or Excel format.
1. Print unchecked options of single-selection or multi-selection fields
For single-selection and multi-selection fields of tile type, if you need to print unchecked options, add _Alloptions
to the field code or ID or alias.
For example: #{Status _Alloptions}
:
2. Printing rules for images
2.1 Set width and height of the image
The image in the record can be printed and you can set the width and height of the image.
As in the code for the file field in the image above #{File$[90*auto]$}
in which [90*auto] means [width*height].
Four ways to configure the image:
Width fixed, height adaptive:
#{File $[90*auto]$}
It means the width of the image is fixed to 90 and the height is adaptive. 90 is the default number and can be customized.Width adaptive, height fixed:
#{File $[auto*80]$}
It means the width of the image is adaptive and the height is fixed to 80, which can be customized.Width fixed, height fixed:
#{File $[70*90]$}
It means the width of the image is fixed to 70, and the height is fixed to 90, which can be customized.Width and height adaptive in a fixed range:
#{File $[45*90_auto]$}
It means the image is displayed adaptively in the range of 45*90, which can be customized.
Set at least a range for width and height, for example
#{file$[auto*auto]$}
, such format is not supported.
2.2 Set quality of the image
In order to satisfy the user's requirements for picture clarity, the images in the template in Word format can be parsed into three kinds of image quality, low, medium and high.
Low (L) - it corresponds to a picture resolution of 75, according to a multiple of X3 to taking the width and height of the picture; which generates a picture fast, for general printing.
Medium (M) - it corresponds to a picture resolution of 150, taking the width and height of the picture according to a multiple of X6; it is clearer when printing.
High (H) - it corresponds to a picture resolution of 300, and takes the width and height of the picture according to a multiple of X12; which generates a picture slowly and is used for high-quality color printing.
Example of field code:
#{File $[auto*90_M]$}
, #{File $[auto*90_H]$}
, #{File $[45*90_auto_H]$}
If you don't add the image quality tag, it means that the image will be parsed in low quality by default.
In order to ensure that the parsed image is not larger than the original image, so it needs to compare the size of the parsed image with the original image, if the parsed image is larger than the original image, then return the original image.
3. Print the QR code or barcode
The QR code or barcode for any field can be obtained by code. The field code is as follows:
- QR Code:
#{[qrcode]field name$[20*20]$}
- Barcode:
#{[barcode]field name$[40*10]$}
In the code, for the field name you can use the field ID; the number representing the size of the picture can be adjusted, and the other contents cannot be modified.
Encoding method of QR code: QR-code, it contains up to 150 characters (including Chinese characters); Encoding method of barcode: code128, it contains up to 30 characters (only numbers, letters and symbols are supported).
Code Example:
Field IDs for several system fields
- Public shared link: sharelink
- Link for internal members: privatelink
- Record ID:recordid
4. Four ways to print subforms and associated worksheets (multiple rows)
Way 1: When the display mode is a list
By default, the field values (including empty values) of all records are listed in a table in the order of the records, row by row, downwards.
Example 1: List the purchase details on a purchase order with a fixed format.
Template Design:
Print:
Serial number in the details table
Template in Word
In the details table, use the function in Word to set the style of the serial number.
Template in Excel
It is necessary to use the formula in Excel ROW () to get the row where the current cell belongs, and then subtract the previous rows. As shown below, the first row of the details worksheet belongs to row 10, then it is
= ROW () -9
.Effect:
Merge cells
Cells can be merged when the contents of the upper and lower cells in the same column are the same.
Field codes for merging cells:
#{Subform name. Field name [M]}
Simply write an [M] between the field name and the curly brackets in the original field code.
As shown below:
Effect:
Cells are not merged in the following cases
You set to merge the cells with the same amount in the unit price column, but the cells with the same amount are not all merged, this is because the previous column (SKU) is also set to merge cells, and if the values of the cells in the previous column (SKU column) are different, the cells are not merged, then the cells in the current column (unit price column) are not merged either.
Way 2: Print record by record
If you need to print each associated record or each record in a subform one by one and display the field titles when printing each row of records, you can insert the following code in the upper and lower rows of the table:
#Relation.Repeat[start]#
#Relation.Repeat[end]#
All the content between the codes is copied in each record and filled with the corresponding data, so it can be a multi-row and multi-column layout.
The code cannot be placed in a cell with other content, and needs to be on a separate row.
For example, in the Purchase Order worksheet, print each piece of purchase detail separately.
Print:
Format 1 is commonly used to print salary details.
Template:
TIPS:
If there needs to be a blank row between each record, there also needs to be a blank row in the template and set to no border lines.
Way 3: Splicing printing
It will splice all the values of the same field together, separated by commas.
Template:
You need to prefix the last curly bracket of the field code with [S], [] in English, and an uppercase S.
Way 4: Fill printing
For example, there are 10 rows of records in the subform, if you only print the specified records in the detail worksheet, you can take this method.
As shown in the following code, add the serial number after the worksheet name. The following code indicates that only the first two rows of records printed.
Template:
Effect:
No printing when subform or associated worksheet is empty
To not print empty associated worksheets or subforms, insert two code tags, #NoDataNotPrint[start]#
and #NoDataNotPrint[end]#
into the template. In this way, the empty associated records or subforms between the codes will not be printed. The configuration is as follows.
When there is data in the associated worksheet:
When there is no data in the associated worksheet:
If there are multiple subforms or associated worksheets between the no-data start label and the end label, as long as one of the subforms or associated worksheets has data, the other no-data subforms or associated worksheets will be printed as well. Therefore, it is recommended to configure a separate set of labels for a subform or an associated worksheet. Moreover, different subforms or details worksheets cannot be put in one big form, they all have to be configured in a separate form.
5. Date printed
Printing time needs to be updated in real time, and there is no time field in the worksheet for real-time updating. Therefore, it is necessary to rely on Word and Excel's own features.
Excel
Use the formula NOW() to get the printing time.
Word
Click the where the printing time is
Select [Insert] > [Date] from the top toolbar, and check [Auto Update] after selecting the date format (check twice for date and time).
After saving, you can open and close the template file several times to see if the print time changes. If the time is updated automatically, just upload the template.
6. Batch print
View more details in Batch Print Records.
Have questions about this article? Send us feedback