Applying a report template

Parent Previous Next

 

Report Application Server .NET SDK Developer Guide

Applying a report template


 







Templates allow you to apply predefined formatting, fields, and other items to a report using another report that you have already created. For example, you could create a report that has common features all your reports share, such as common hyperlinks, company letter head, and so on.

To apply a template, you must have a report that will act as a template. You then use the ReportTemplateEngine class to amalgamate the template report with any other report.

NoteNote

Applying a template to a report is similar to applying a style. The difference lies in the flexibility that templates offer. Styles are fixed and predefined, while templates may be customized to meet your needs.

The following code applies a report template from an existing report to a target report.

NoteNote

This example uses the ApplyToDocument method of the ReportTemplate class. You may also use the ApplyTo method which allows you to pass in a file path to the target report rather than opening it as a ReportClientDocument object.

Visual Basic

Private Sub ChangeTemplate(ByVal templateRCD As ISCDReportClientDocument, ByVal targetRCD As ISCDReportClientDocument)
 Dim templateEngine As ReportTemplateEngine = New ReportTemplateEngineClass()
 Dim reportTemplate As ReportTemplate = templateEngine.CreateTemplateFromDocument(templateRCD)
 reportTemplate.ApplyToDocument(targetRCD)
End Sub

C#

private void ChangeTemplate(ISCDReportClientDocument templateRCD, ISCDReportClientDocument targetRCD)
{
 ReportTemplateEngine templateEngine = new ReportTemplateEngineClass();
 ReportTemplate reportTemplate = templateEngine.CreateTemplateFromDocument(templateRCD);
 reportTemplate.ApplyToDocument(targetRCD);
}

This list includes the namespaces used by the sample code:

© 2021 SAP AG. All rights reserved.

http://www.sap.com/sapbusinessobjects/

Support services

http://service.sap.com/bosap-support/

Created with the Personal Edition of HelpNDoc: Create cross-platform Qt Help files