On the developer's server side. This solution will enable the application to deliver a document to the user's browser using a MSWord template without programming. Look at the following very simple example -
|Report using MSWord template and an ASCII feed file|
<script language='vb' runat='server'> Sub Page_Load(Source as Object, E as EventArgs) Dim Rep As New Tornado.Z() Rep.ASPdbSendReport("./_Word_Report.doc", "./_Word_Report.txt") End Sub </script>
This one liner example use a MSWord template and an ASCII feed file to fill the template's tags. The following is what the template doc file looks like. The [[tags]] are data tags to be filled by the feed data.
Note: The template file can be physical or local virtual. The data feed ascii file can be physical, local virtual or remote virtual. Now can see that you can feed the template from the server or the client's workstation like http://www.yourcompany.com/user/userreport.txt" !!!
|File = _Word_Report.txt (ASCII data feed)|
[[LOG]]12345 [[OI]]56789 [[ON]]John Doe [[DOB]]10/14/1955 [[SSN]]123456789 [[DL]]B1234567 [[ST]]CA [[CI]]123456 [[CDC]]9876 [[CII]]54321 [[CN]]Name #1 [[VN]]Name #2 [[PR]]Name #3 [[AC]]12345 12345 12345 [[CC]]Any County [[LE]]SBPD [[CD]]6/9/2000 [[AD]]6/10/2000 [[DTC]]9/10/2000 [[CCD]]10/10/2000 [[CCY]]X [[CCN]] [[CCVCY]] [[CCVCN]]X [[FDC]]X [[FDF]]X [[FDM]]X [[FDA]]X [[FDJ]]X [[SCDCI]]X [[SCDCY]]4 [[SCDCM]]0 [[SCYAI]]X [[SCYAY]]0 [[SCYAM]]6 [[SCJII]]X [[SCJIY]]1 [[SCJIM]]6
The above template is stuffed by the ASCII data feed. Execute the example and you'll see the [[Now(MM.dd.yy)]] tag is replaced by the clock, the [[LOG]] tag is replaced by '12345' and the [[ON]] tag is replaced by 'John Doe' etc.. As you can imagine in this case, the report can be changed w/o any programming as either or both of the template and feed data file can be modified externally.
There are many options with the template like clock, left/middle/right justification, value format, Equation, field, raw field and session variables. These template macro is very useful in formatting your report.
|Report using MSWord template and a Database feed|
<script language="VB" runat="server"> Dim Mydb As New Tornado.Z() With Mydb .dbQP = "U=1| iv=true| S=plain| Q=Products|D=NWIND.mdb" .ASPdbNET() .ASPdbSendReport("T_TEST.doc") End With </script>
In this example, the .ASPdbNet() generates the DB data and the .ASPDBSendReport sends the report using the _Word_Test.Doc template. The time is right justified in the tag and the [[RF::PRODUCTNAME]] is stuffed by the raw value of Field 'ProductName'. A user input value 12345 is formatted as currency in the report.
|Word Template - _Word_Test.Doc|
Report Template Test Time: [[ Now(D)]] Field 1: [[RF::PRODUCTNAME]] Field x : Test Value : [[V::12345::c]]