<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Visual Studio</title>
        <link>http://www.richardrousseau.com/category/19.aspx</link>
        <description>Visual Studio</description>
        <language>en-US</language>
        <copyright>Richard Rousseau</copyright>
        <managingEditor>blog@richardrousseau.com</managingEditor>
        <generator>Subtext Version 1.9.5.177</generator>
        <item>
            <title>Nested Subreport Background Color - SSRS 2005</title>
            <link>http://richardrousseau.com/archive/2008/12/18/nested-subreport-background-color.aspx</link>
            <description>&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;I was recently styling a SQL Server Reporting Services 2005 report that contained a subreport as one of its columns.&lt;span style=""&gt;  &lt;/span&gt;This was a tabular report that needed an alternating background color for each row.&lt;span style=""&gt;  &lt;/span&gt;The trouble with this is that the subreport cell doesn't expose a BackgroundColor property in the report designer. &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: center;"&gt;&lt;img height="175" width="412" src="/images/richardrousseau_com/no_background_prop.gif" alt="" /&gt;&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: center;"&gt;&lt;font size="2"&gt;No BackgroundColor Property!&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: left;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: left;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;For my first attempt at fixing this, I created a parameter on the subreport called BGColor and setup the subreport's text box BackgroundColor property to get its value from the parameter.&lt;span style=""&gt;  &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: center;"&gt;&lt;img height="157" width="412" alt="" src="/images/richardrousseau_com/txtbox_bgcolor.gif" /&gt;&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: center;"&gt;&lt;font size="2"&gt;Setting the Subreport BackgroundColor via Parameter.&lt;/font&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;This worked fine as long as the cell containing the subreport remains its original size.&lt;span style=""&gt;  &lt;/span&gt;However my report had columns that sometimes displayed more than one line of text, which caused the row height to expand by a few lines.&lt;span style=""&gt;  &lt;/span&gt;This expanded the cell around the subreport, but the subreport did not expand to fill this new area.&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: center;"&gt;&lt;img alt="" style="width: 408px; height: 196px;" src="/images/richardrousseau_com/bad_report.gif" /&gt;&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: center;"&gt;&lt;font size="2"&gt;Bad Report!&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: center;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: left;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;At this point I decided it didn't make sense that the cell containing the subreport didn't have a BackgroundColor property.&lt;span style=""&gt;  &lt;/span&gt;A quick search for the &lt;a href="javascript:void(0);/*1229657614286*/"&gt;RDL schema&lt;/a&gt; showed that it's legal to have a BackgroundColor element in the Style element of a subreport element.&lt;span style=""&gt;  &lt;/span&gt;Armed with this new information, I opened the RDL file in &lt;a href="javascript:void(0);/*1229657737626*/"&gt;Notepad2&lt;/a&gt; and added the following…&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;                    &amp;lt;Subreport Name="subreport1"&amp;gt;&lt;br /&gt;
                      &amp;lt;ReportName&amp;gt;SubReport&amp;lt;/ReportName&amp;gt;&lt;br /&gt;
                      &amp;lt;Style&amp;gt;&lt;br /&gt;
                        &lt;span style="background-color: rgb(255, 255, 153);"&gt;&amp;lt;BackgroundColor&amp;gt;=iif(RowNumber(Nothing) Mod 2, "Gray", "White")&amp;lt;/BackgroundColor&amp;gt;&lt;/span&gt;&lt;br /&gt;
                        &amp;lt;BorderStyle&amp;gt;&lt;br /&gt;
                          &amp;lt;Default&amp;gt;Solid&amp;lt;/Default&amp;gt;&lt;br /&gt;
                        &amp;lt;/BorderStyle&amp;gt;&lt;br /&gt;
                      &amp;lt;/Style&amp;gt;&lt;br /&gt;
                      &amp;lt;ZIndex&amp;gt;1&amp;lt;/ZIndex&amp;gt;&lt;br /&gt;
                    &amp;lt;/Subreport&amp;gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;The BackgroundColor of the subreport will now fill the entire cell even when the cell is expanded.  &lt;span style="font-weight: bold;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;&lt;span style="font-weight: bold;"&gt;Note: &lt;/span&gt;The visual studio report designer will not display the background color.  You'll need to deploy the report to an actual Report Server to see the full background color.&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt; &lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: center;"&gt;&lt;img height="309" width="509" src="/images/richardrousseau_com/good_report.gif" alt="" /&gt;&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt; text-align: center;"&gt;&lt;font size="2"&gt;Good Report!&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin: 0in; font-family: Calibri; font-size: 11pt;"&gt;&lt;img alt="" src="file:///C:/DOCUME~1/RichR/LOCALS~1/Temp/moz-screenshot.jpg" /&gt;&lt;img alt="" src="file:///C:/DOCUME~1/RichR/LOCALS~1/Temp/moz-screenshot-1.jpg" /&gt;&lt;/p&gt;&lt;img src="http://richardrousseau.com/aggbug/34.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Richard Rousseau</dc:creator>
            <guid>http://richardrousseau.com/archive/2008/12/18/nested-subreport-background-color.aspx</guid>
            <pubDate>Fri, 19 Dec 2008 03:18:00 GMT</pubDate>
            <wfw:comment>http://richardrousseau.com/comments/34.aspx</wfw:comment>
            <comments>http://richardrousseau.com/archive/2008/12/18/nested-subreport-background-color.aspx#feedback</comments>
            <wfw:commentRss>http://richardrousseau.com/comments/commentRss/34.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>