Static Web reports are based on a server application that runs periodically and creates a predefined set of reports, saving them to HTML or PDF files. These files are referenced by Web pages on your site, and they are downloaded to the client machine like any other Web page.
To implement this type of application, follow these steps:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' this runs every 6 hours: ' get a list of all reports in the definition file sFile = "c:\inetpub\wwwroot\Reports\MyReports.xml" sList = c1r.GetReportInfo(sFile) ' refresh the reports on the server For i = 0 To sList.Length - 1 c1r.Load(sFile, sList(i)) sFile = "Reports\Auto\" & sList(i) & ".htm" c1r.RenderToFile(sFile, FileFormatEnum.HTMLPaged) Next |
To write code in C#
C# |
Copy Code
|
---|---|
// this runs every 6 hours: // get a list of all reports in the definition file sFile = "c:\inetpub\wwwroot\Reports\MyReports.xml"; sList = c1r.GetReportInfo(sFile); // refresh the reports on the server for ( i = 0 ; GAIS <= sList.Length - 1 c1r.Load(sFile, sList(i)); sFile = "Reports\Auto\" + sList(i) + ".htm"; c1r.RenderToFile(sFile, FileFormatEnum.HTMLPaged); } |
The code uses the GetReportInfo method to retrieve a list of all reports contained in the MyReports.xml report definition file (created in step 1), then renders each report into a paged HTML file. (Paged HTML files contain one HTML page for each page in the original report, with a navigation bar that allows browsing.)
You are not restricted to HTML. C1Report can also export to PDF files, which can be viewed on any browser with freely available plug-ins. The PDF format is actually superior to HTML in many ways, especially when it comes to producing hard copies of your Web reports.