To make our formatting easily modifiable, use an XML file
with different nodes. For this article, there is an XML file with the
following format in Listing 2.
Listing 2
<Formats>
<PageHeader>
<FontFamily>Arial</FontFamily>
<FontSize>16</FontSize>
<FontWeight>Bold</FontWeight>
<FontColor>Navy</FontColor>
<BackGroundColor>Gold</BackGroundColor>
</PageHeader>
<GroupHeader>
<FontFamily>Arial</FontFamily>
<FontSize>14</FontSize>
<FontWeight>Bold</FontWeight>
<FontColor>Navy</FontColor>
</GroupHeader>
</Formats>
The xml contains nodes that should map to different sections
in the report. For instance, for the PageHeader section, we have a node
PageHeader. You can create a different node for each section in a report (ReportHeader,
PageFooter, etc.). Each section can contain the formatting options for the font
name (fontfamily), FontSize, FontWeight, FontColor and BackgroundColor. That is
the extent of the sample in this article. This file could be extended to add
other formatting options. For the purposes of this article, the number of
elements is kept small.