SSRS報表服務隨筆(rdl報表服務)-報表結構與樣式
阿新 • • 發佈:2019-01-11
設計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"Reporting報表> <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>
報表版式
限於頁首頁尾的資料,不能用於主體,比如頁碼,會導致報表報錯
在報表資料的內建欄位,是全部可以放在頁首和頁尾中,部分可以放在主體中
限於主體的資料,不能直接放在頁首和頁尾,可以通過聚合來實現現在在頁首,比如求和,平均值等等
在分組資料中,不能直接放到頁首和頁尾,可以對分組進行分頁,然後顯示First(欄位名)顯示到頁首頁尾中
報表樣式
在第一篇就說明了,有地圖,各種圖,表和矩陣
下面是分頁報表的所有佈局控制元件
內嵌欄位
具體也不用我講了吧,看字面意思就知道是做什麼來著
若有問題,請大家指出