An interesting question arose today: how can I re-use a standard, centrally managed header/footer definition in all Reporting Services reports. The intention being to reduce management overhead when the definition of a header/footer changes to avoid having to fix all individual reports.
A solution to this is to manipulate the Report Definition Language (RDL) files that Reporting Services uses to produce reports. Each RDL file has a <PageHeader> and <PageFooter> node, in which the definition for the header/footer exists. By creating a standard reference RDL file that simply contains one of these nodes with the full header/footer definition, this reference node can then be copied over the appropriate node in all the report RDL files using a short piece of code.
The following is the basic C# code that uses the .NET framework's System.Xml namespace to manipulate a report file. The purpose of the code is to:
Here is the code: