Skip to content

Template Files

Template files contain commands that control the printing or the export of calculation results.

Keywords (see Chapter 3 - Keywords of the CadnaA manual „Attributes, Variables & Keywords“) are essential components of these commands. A text editor or a word processor is used to create a text file containing those commands and - if required - additional text. This file is saved in TXT (ASCII), RTF (Rich Text Format) or in DOCX (MS-Word) format and ready to be selected as a template file for output and export.

Template Files for TXT and RTF Formats

Structure

Keywords in template files must appear in parentheses, preceded by a hash symbol (#) before the leading parentheses. The parameters of a keyword follow the keyword itself, enclosed within the same parentheses, separated by commas from each other.

Example Command

Another example of a command printing the word „CadnaA“ using font Times Roman, size 14 pt and in bold is:

#(Font, Times Roman, 14, f)CadnaA

In case some parameters are missing, the default value is used. For instance, assuming that the font would not have been specified, so:

#(Font,,14,f)CadnaA

the (default) font Arial would have been used instead for printing the text.

As part of the template file, ordinary text an be entered not requiring a keyword. This enables to design reports or protocols containing the actual calculation results.

The following figure shows the first lines of the delivered template file print.txt with a more complex structure.

Labeling of Printing Ranges

The template files can be structured by the label ## to mark printing ranges. These will appear for selection in the Print dialog. Printing ranges may be selected individually or a selection or sequence. Where a printing range starts in the template file, enter a text - preferably one word, no blanks - identifying this range. Before this text, without blanks in between, insert two ##.

##Project-Info
##Groups_Day_Night
##PartialLevels_Day_Night
##Point_Sources
##Line_Sources
##Area_Sources
...
{lang="plain text"}

Anything appearing in the template file after - for example - „Point Sources“, but before the next printing range label, is printed. The labels themselves are not printed.

The printing range defined in the template file appear on the Print Report dialog.

Supplied Template Files

The following types of template files are supplied by default and can be either used as they are or modified (edited):

Example

Path: Examples\Export\Template Files

  • print.txt - template file for direct printout from CadnaA
  • export.txt - template file for exporting. The output file to which the results are exported is also an ASCII file which can be imported by any program capable of processing ASCII files (including, e.g. MS-Excel).
  • export.rtf - Template file for exporting. The output file to which the results are exported is also a Rich Text Format file which can be imported by almost any word processor. With rtf-format, tables will remain tables with frames when imported to a word processor (e.g. MS-Word). Font types, paragraphs, and tab stops can be formatted in the word processor.

Template Files for DOCX Export

Structure

The template file for DOCX export is created in MS-Word and may use all available kind of text format. This includes headers/footers, images, running text, and CadnaA specific keywords.

Note

For the generation of tables, see below.

The symbol # (hash) must be avoided - except for keywords. For multi-page output, hard page breaks can be inserted.

The keywords within a DOCX template file are in parentheses as usual, with the symbol # placed in front of the parenthesis. The parameters of the keywords follow after the keyword, but within the parenthesis and are separated by commas.

Types of Tables

There are two types of tables available: user-defined and predefined tables.

Example

Path: Examples\Export\Template Files\ template_export.docx

For a better understanding, open the referenced DOCX template file using MS-Word. The following explanations refer to this file.

User-defined Tables

User-defined tables are created from rows and columns using the MS-Word table tools. The following rules apply:

  • This first row, first column must contain:
    • #(CUSTOM_TABLE, <table_keyword>)
    • The <table keyword> is a keyword defined for each object table (see Table in the manual „Attribute, Variables and Keywords“).
    • NOTE: This cell must be inside a table! This row will get removed on export.

Note

In the reference CUSTOM_TABLE_<table name> only those keyword addressing CadnaA object tables can be used, especially not the keywords for geometry tables.

  • The subsequent (three) rows containing normal text will remain on export (using the present text formatting).
  • NOTE: Do not use the hash # in normal header rows!
  • The following line contains columns that each establish a reference to an object-specific attribute. A reference is established using the table-specific keyword COL:
    • #(COL, <keyword>, <fractional digits>)
    • NOTE: The suffix <fractional digits> applies for numerical object attributes only (see Table Object Attributes in the manual „Attributes, Variables and Keywords“).
    • NOTE: No further keywords are allowed any of these cells!
    • NOTE: The formatting of each cell is applied.
  • Any lines following the first line with #(COL, ...) are kept, while keywords are ignored. This means that just a single row using the #(COL, ...) statement can be used per table object.

Predefined Tables

There are three ways to use predefined tables:

  • „Table-in-line“: The formatting (not using the MS-Word table object) is the same for the entire table and corresponds to this line. Example: #(Table, PQ)
  • Table with definition: When the keyword #(Table, ...) is identified in a table, the formatting of the first line is used as header format, and the second line is used as format for the table‘s content. Example: #(Table, PQ)
  • Table using a tbl file (table format file): The format files generated when saving edited object tables have the file extension *.tbl (see Editing Object Tables). An absolute or a relative reference to tbl-files can be established:
    • absolute file path, Example: #(Table, PQ, D:\DATA\cna docx\pq_short.tbl)
    • relative file path: Just the name of the tbl-file is used in the reference. The tbl-file must be in the same folder as the template file. Example: #(Table, PQ, pq_short.tbl)

Supplied Template Files DOCX

When exporting DOCX you may use the current object table format or define your own table format for export:

Example

Path: Examples\Export\Template Files

  • template_export.docx: template file for exporting object tables to MS-Word with a table formatting specified in the template file (exported file in DOCX format)
  • template_export_object_tables.docx: template file to export of object tables to MS-Word using the current table format (exported file in DOCX format)

Template Files for XLSX Export

The template for XLSX export is generated using MS-Excel and may contain all text formats available in MS-Excel and also CadnaA specific keywords. The advantage of a template file in XLSX format is that it allows for additional calculations within MS-Excel using the exported data. For example, penalties may be added to calculate an evaluation level.

Example

Path: Examples\Export\Template Files\ template_export.xlsx

For a better understanding, open the referenced XLSX template file using MS-Excel. The following explanations refer to sheet IMM in this file.

User-defined template files XLSX

User-defined tables are generated in MS-Excel from columns and rows. A single sheet in MS-Excel may contain several tables. These tables, however, must be arranged side by side, but not above each other.

The following rules apply:

  • The table header can contain any kind of text. Keywords (see Chapter 3 - Keywords in the manual „Attributes, Variables and Keywords“) may be used in the table‘s header or in cells outside (preferably above) of tables.
  • The first row below the table header is the data row whose cells contain references to object attributes or use formulas.
  • The entire row of all data cells must be labeled using the MS-Excel feature „range“ or „named range“. The following structure is mandatory: CUSTOM_TABLE_<table name> denotes the specific keyword of an object table where the data results from (see Table in the manual „Attribute, Variables and Keywords“).Example: CUSTOM_TABLE_IMM (for the „Receivers“ table)

Note

In the reference CUSTOM_TABLE_<table name> only those keyword addressing CadnaA object tables can be used, especially not the keywords for geometry tables.

  • After having named the data row, references or formulas can be established for each cell of that range:
    • A reference to an object attribute is created via the Note feature of an MS-Excel cell (by clicking with the right mouse button into the cell and selecting the command „New Note“). This makes use of the table-specific keyword #(COL, <keyword>, <fractional digits>, <rounding>). Further relevant points:
      • The suffix <fractional digits> applies for numerical object attributes only (see Table Object Attributes in the manual „Attributes, Variables and Keywords“). In case this suffix is missing the default format is used (mostly 1 fract. digit).
      • The text formatting of each cell is retained on export.
      • No further keywords are allowed in a cell!
  • Alternatively, a cell may contain a formula that is defined according to the MS-Excel specific rules. But, references can be established to the current line only, for example:Sum=E8+F8+G8 is allowedSum=E8+F6+G8 is not allowed!

Note

If both, a reference and a formula are defined in a cell, only the reference is evaluated.

Predefined Tables

Furthermore, also the predefined tables can be used, for example:

Example

Path: Examples\Export\Template Files\ template_export.xlsx

  • Excel-sheet „Libl“: exports the Sound Levels table #(Table, LibL)
  • Excel-sheet „ErgTab“: exports the Result Table #(Table, ErgTab)
  • Excel-sheet „NutzGeo“: exports the geometry data of the areas of designated use #(Table, Nutz_Geo)

Note

Furthermore, it is possible to access tables which have been formatted using a tbl-file (table format file, see Template Files for DOCX Export). In both cases, however, it is not possible to use references or formulas.