SSRS报表服务随笔(rdl报表服务)-报表结构与样式

设计rdl报表,比设置HTML页面简单多了,Reporting报表分为页眉,页脚,主体三个部分

rdl文件实际是xml结构的文件,具体是什么语言呢,很抱歉,这点我还不能回复,在我看来,是由固定节点的xml文本

报表结构

  通过查看Reporting的报表,一个完整的报表,包含报表的一些配置(默认字体样式,自动刷新,语言,容器空白,报告单元类型,报表ID),数据源,数据集,报告部分(相当于容器),报表参数,报表参数布局这几个主要组成部分,根据报表样式的不同会有不同的组成部分,比如在报表中内嵌了一个图片,那么会多一个内嵌式图片的结构

此处附上一个rdl报表的代码

<?xml version="1.0" encoding="utf-8"?>
<Report MustUnderstand="df" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:df="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily">
<df:DefaultFontFamily>Segoe UI</df:DefaultFontFamily>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSource1">
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>Data Source=DESKTOP-A2OHBFG\MSSQLSERVER2016;Initial Catalog=CN_BBG_TEST1108</ConnectString>
</ConnectionProperties>
<rd:SecurityType>None</rd:SecurityType>
<rd:DataSourceID>2a3c9c46-1d9d-470c-a113-05fac2f082d4</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>DataSource1</DataSourceName>
<CommandText>select * from student</CommandText>
</Query>
</DataSet>
</DataSets>
<ReportSections>
<ReportSection>
<Body>
<ReportItems>
<Chart Name="DataBar1">
<ChartCategoryHierarchy>
<ChartMembers>
<ChartMember>
<Label />
</ChartMember>
</ChartMembers>
</ChartCategoryHierarchy>
<ChartSeriesHierarchy>
<ChartMembers>
<ChartMember>
<Label />
</ChartMember>
</ChartMembers>
</ChartSeriesHierarchy>
<ChartData>
<ChartSeriesCollection>
<ChartSeries Name="Series">
<ChartDataPoints>
<ChartDataPoint>
<ChartDataPointValues>
<Y>=123</Y>
</ChartDataPointValues>
<ChartDataLabel>
<Style />
</ChartDataLabel>
<Style />
<ChartMarker>
<Style />
</ChartMarker>
<DataElementOutput>Output</DataElementOutput>
</ChartDataPoint>
</ChartDataPoints>
<Subtype>Stacked</Subtype>
<Style />
<ChartEmptyPoints>
<Style />
<ChartMarker>
<Style />
</ChartMarker>
<ChartDataLabel>
<Style />
</ChartDataLabel>
</ChartEmptyPoints>
<ValueAxisName>Primary</ValueAxisName>
<CategoryAxisName>Primary</CategoryAxisName>
<ChartSmartLabel>
<CalloutLineColor>Black</CalloutLineColor>
<MinMovingDistance>0pt</MinMovingDistance>
</ChartSmartLabel>
</ChartSeries>
</ChartSeriesCollection>
</ChartData>
<ChartAreas>
<ChartArea Name="Default">
<ChartCategoryAxes>
<ChartAxis Name="Primary">
<Visible>False</Visible>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>None</Style>
</Border>
<FontSize>8pt</FontSize>
<Color>#5c5c5c</Color>
</Style>
<ChartAxisTitle>
<Caption />
<Style>
<FontSize>9pt</FontSize>
<Color>#5c5c5c</Color>
</Style>
</ChartAxisTitle>
<Margin>False</Margin>
<ChartMajorGridLines>
<Enabled>False</Enabled>
<Style>
<Border>
<Color>Gainsboro</Color>
</Border>
</Style>
</ChartMajorGridLines>
<ChartMinorGridLines>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>Dotted</Style>
</Border>
</Style>
</ChartMinorGridLines>
<ChartMajorTickMarks>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>None</Style>
</Border>
</Style>
</ChartMajorTickMarks>
<ChartMinorTickMarks>
<Style>
<Border>
<Color>Gainsboro</Color>
</Border>
</Style>
<Length>0.5</Length>
</ChartMinorTickMarks>
<CrossAt>NaN</CrossAt>
<Minimum>NaN</Minimum>
<Maximum>NaN</Maximum>
<ChartAxisScaleBreak>
<Style />
</ChartAxisScaleBreak>
</ChartAxis>
<ChartAxis Name="Secondary">
<Visible>False</Visible>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>None</Style>
</Border>
<FontSize>8pt</FontSize>
<Color>#5c5c5c</Color>
</Style>
<ChartAxisTitle>
<Caption />
<Style>
<FontSize>9pt</FontSize>
<Color>#5c5c5c</Color>
</Style>
</ChartAxisTitle>
<Margin>False</Margin>
<ChartMajorGridLines>
<Enabled>False</Enabled>
<Style>
<Border>
<Color>Gainsboro</Color>
</Border>
</Style>
</ChartMajorGridLines>
<ChartMinorGridLines>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>Dotted</Style>
</Border>
</Style>
</ChartMinorGridLines>
<ChartMajorTickMarks>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>None</Style>
</Border>
</Style>
</ChartMajorTickMarks>
<ChartMinorTickMarks>
<Style>
<Border>
<Color>Gainsboro</Color>
</Border>
</Style>
<Length>0.5</Length>
</ChartMinorTickMarks>
<CrossAt>NaN</CrossAt>
<Location>Opposite</Location>
<Minimum>NaN</Minimum>
<Maximum>NaN</Maximum>
<ChartAxisScaleBreak>
<Style />
</ChartAxisScaleBreak>
</ChartAxis>
</ChartCategoryAxes>
<ChartValueAxes>
<ChartAxis Name="Primary">
<Visible>False</Visible>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>None</Style>
</Border>
<FontSize>8pt</FontSize>
<Color>#5c5c5c</Color>
</Style>
<ChartAxisTitle>
<Caption />
<Style>
<FontSize>9pt</FontSize>
<Color>#5c5c5c</Color>
</Style>
</ChartAxisTitle>
<ChartMajorGridLines>
<Style>
<Border>
<Color>Gainsboro</Color>
</Border>
</Style>
</ChartMajorGridLines>
<ChartMinorGridLines>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>Dotted</Style>
</Border>
</Style>
</ChartMinorGridLines>
<ChartMajorTickMarks>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>None</Style>
</Border>
</Style>
</ChartMajorTickMarks>
<ChartMinorTickMarks>
<Style>
<Border>
<Color>Gainsboro</Color>
</Border>
</Style>
<Length>0.5</Length>
</ChartMinorTickMarks>
<CrossAt>NaN</CrossAt>
<Minimum>0</Minimum>
<Maximum>NaN</Maximum>
<ChartAxisScaleBreak>
<Style />
</ChartAxisScaleBreak>
</ChartAxis>
<ChartAxis Name="Secondary">
<Visible>False</Visible>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>None</Style>
</Border>
<FontSize>8pt</FontSize>
<Color>#5c5c5c</Color>
</Style>
<ChartAxisTitle>
<Caption />
<Style>
<FontSize>9pt</FontSize>
<Color>#5c5c5c</Color>
</Style>
</ChartAxisTitle>
<ChartMajorGridLines>
<Style>
<Border>
<Color>Gainsboro</Color>
</Border>
</Style>
</ChartMajorGridLines>
<ChartMinorGridLines>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>Dotted</Style>
</Border>
</Style>
</ChartMinorGridLines>
<ChartMajorTickMarks>
<Style>
<Border>
<Color>Gainsboro</Color>
<Style>None</Style>
</Border>
</Style>
</ChartMajorTickMarks>
<ChartMinorTickMarks>
<Style>
<Border>
<Color>Gainsboro</Color>
</Border>
</Style>
<Length>0.5</Length>
</ChartMinorTickMarks>
<CrossAt>NaN</CrossAt>
<Location>Opposite</Location>
<Minimum>NaN</Minimum>
<Maximum>NaN</Maximum>
<ChartAxisScaleBreak>
<Style />
</ChartAxisScaleBreak>
</ChartAxis>
</ChartValueAxes>
<Style>
<BackgroundColor>#00ffffff</BackgroundColor>
<BackgroundGradientType>None</BackgroundGradientType>
</Style>
<ChartElementPosition>
<Top>3</Top>
<Left>10</Left>
<Height>96</Height>
<Width>80</Width>
</ChartElementPosition>
</ChartArea>
</ChartAreas>
<Palette>BrightPastel</Palette>
<ChartBorderSkin>
<Style>
<BackgroundColor>Gray</BackgroundColor>
<BackgroundGradientType>None</BackgroundGradientType>
<Color>White</Color>
</Style>
</ChartBorderSkin>
<ChartNoDataMessage Name="NoDataMessage">
<Caption>没有可用数据</Caption>
<Style>
<BackgroundGradientType>None</BackgroundGradientType>
<FontWeight>Bold</FontWeight>
<TextAlign>General</TextAlign>
<VerticalAlign>Top</VerticalAlign>
</Style>
</ChartNoDataMessage>
<rd:DesignerMode>DataBar</rd:DesignerMode>
<DataSetName>DataSet1</DataSetName>
<Top>1.31974cm</Top>
<Left>4.67995cm</Left>
<Height>1.25cm</Height>
<Width>3.75cm</Width>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>White</BackgroundColor>
<BackgroundGradientType>None</BackgroundGradientType>
</Style>
</Chart>
</ReportItems>
<Height>5.13367in</Height>
<Style />
</Body>
<Width>8.78968in</Width>
<Page>
<PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth>
<LeftMargin>2cm</LeftMargin>
<RightMargin>2cm</RightMargin>
<TopMargin>2cm</TopMargin>
<BottomMargin>2cm</BottomMargin>
<ColumnSpacing>0.13cm</ColumnSpacing>
<Style />
</Page>
</ReportSection>
</ReportSections>
<ReportParametersLayout>
<GridLayoutDefinition>
<NumberOfColumns>4</NumberOfColumns>
<NumberOfRows>2</NumberOfRows>
</GridLayoutDefinition>
</ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>ab81ed71-215d-4adb-b126-6bdadaa2f604</rd:ReportID>
</Report>

Reporting报表

报表版式

  限于页眉页脚的数据,不能用于主体,比如页码,会导致报表报错

    在报表数据的内置字段,是全部可以放在页眉和页脚中,部分可以放在主体中

  限于主体的数据,不能直接放在页眉和页脚,可以通过聚合来实现现在在页眉,比如求和,平均值等等

    在分组数据中,不能直接放到页眉和页脚,可以对分组进行分页,然后显示First(字段名)显示到页眉页脚中

报表样式

  在第一篇就说明了,有地图,各种图,表和矩阵

  下面是分页报表的所有布局控件

  SSRS报表服务随笔(rdl报表服务)-报表结构与样式

 内嵌字段

  SSRS报表服务随笔(rdl报表服务)-报表结构与样式

  具体也不用我讲了吧,看字面意思就知道是做什么来着

邮箱:linjie.rd@gmail.com

若有问题,请大家指出

上一篇:Linux查看内存使用量和交换区使用量


下一篇:HBase 系列(二)—— HBase 系统架构及数据结构