Template file

Template files can be used to transform text based formats or result files to an other format for viewing them. Useful formats are, for example, RTF and HTML, who can display different fonts, colors and images. RTF-files can be viewed with Windows Wordpad editor and HTML-files with the web browser.

The template file is created by some format specific tool (e.g. Wordpad for RTF-format) with desired formatting. Macro #DATAFILE is then added to some place inside the file. This macro defines the position of actual data. Other macros can also be used elsewhere in the template file. For example, format header macro definitions can be used with format converter and result header macro definitions with calculation result files.

When using template file, the original data file is first written normally (e.g. calc.txt or test.gt) and then the actual template based formatted output file is written to the same directory (e.g calc.txt.rtf or test.gt.html). This file is then opened with some application based on the file extension.

With the Text-format it is possible to use Excel spreadsheet as a template. One template spreadsheet cell must contain #DATAFILE macro, which determines the writing start position.


Example template using HTML-format:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>3D-Win Template Demo</TITLE>
</HEAD>
<BODY>
<H1>3D-Win Template Demo</H1>
<P><IMG src="3d.bmp" alt="" border=0></P>
<TABLE>
<TR><TD>Company:</TD><TD>#ORGANIZATION</TD></TR>
<TR><TD>URL:</TD><TD><A href="#url">#URL</A></TD></TR>
</TABLE>
<PRE>
#DATAFILE
</PRE>
<TABLE>
<TR><TD>Points:</TD><TD>#POINTCOUNT</TD></TR>
</TABLE>
</BODY>
</HTML>

Output result file:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>3D-Win Template Demo</TITLE>
</HEAD>
<BODY>
<H1>3D-Win Template Demo</H1>
<P><IMG src="3d.bmp" alt="" border=0></P>
<TABLE>
<TR><TD>Company:</TD><TD>3D-system Oy</TD></TR>
<TR><TD>URL:</TD><TD><A href="http://www.3d-system.fi">http://www.3d-system.fi</A></TD></TR>
</TABLE>
<PRE>
       1       0       0    2115   6697193.356   3444322.792         5.462
       1       0       0    2117   6697179.880   3444325.244         5.192
       1       0       0    2133   6697179.956   3444313.513         5.149
</PRE>
<TABLE>
<TR><TD>Points:</TD><TD>3</TD></TR>
</TABLE>
</BODY>
</HTML>

Result file in browser:

3D-Win Template Demo

Company:3D-system Oy
URL:http://www.3d-system.fi
       1       0       0    2115   6697193.356   3444322.792         5.462
       1       0       0    2117   6697179.880   3444325.244         5.192
       1       0       0    2133   6697179.956   3444313.513         5.149
Points:3