开发者

Pagebreaks in RDLC Subreports don't appear

I am trying to represent a parent-child-grandchild relationship in a SQL Server Reporting Services RDLC report. The report is rendered into a reportviewer control that is hosted in a WPF app. I am using a CLR dataset based on IEnumberable<> and binding the reportviewer datasources to my datasets in a VM.

I want each child entity display on a new page (and span pages if their are enough grand-children in the dataset).

I am currently have a master report for the parent entity, a subreport for the child and another subreport for the grand-children.

Each report is using a Tablix to layout the fields of the corresponding CLR class on the page. I have assigned a Group in the child's subreport's Tablix and set PageBreaks to StartAndEnd (i.e. all 3 checkboxes are selected in the Group Properties dialog).

I have turned off keep together everywhere I can find it.

Unfortunately, the page breaks are ignored when I view the report in Print Layout mode, or export to PDF and the child items in the subreport all flow together without page breaks separating them.

I've seen several issues on SO and MSDN talking about undesired page breaks, but I haven't found any discussion of missing page breaks.

Does anyone know how to force page breaks to appear in sub-reports? If not, is there a better/alternate way to represent parent/child data like this without using a sub-report?

Thanks for any insight you can offer.

FWIW, following are a few excerpts of the RDLC that might be relavent:

Parent Report:

        <TablixRow>
          <Height>0.25in</Height>
          <TablixCells>
            <TablixCell>
              <CellContents>
                <Rectangle Name="Rectangle1">
                  <ReportItems>
                    <Subreport Name="InvoicePageDetail">
                      <ReportName>InvoicePageDetail</ReportName>
                      <Parameters>
                        <Parameter Name="InvoiceID">
                          <Value>=Fields!InvoiceID.Value</Value>
                        </Parameter>
                        <Parameter Name="CustID">
                          <Value>=Fields!CustID.Value</Value>
                        </Parameter>
                      </Parameters>
                      <Height>0.25in</Height>
                      <Width>6.4in</Width>
                      <Style>
                        <Border>
                          <Style>None</Style>
                        </Border>
                      </Style>
                    </Subreport>
                  开发者_运维百科</ReportItems>
                  <PageBreak>
                    <BreakLocation>End</BreakLocation>
                  </PageBreak>
                </Rectangle>
                <ColSpan>3</ColSpan>
              </CellContents>
            </TablixCell>
            <TablixCell />
            <TablixCell />
          </TablixCells>
        </TablixRow>

Sub Report:

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">
  <DataSources>
    <DataSource Name="ISCBillingDataModel">
      <ConnectionProperties>
        <DataProvider>System.Data.DataSet</DataProvider>
        <ConnectString>/* Local Connection */</ConnectString>
      </ConnectionProperties>
      <rd:DataSourceID>50ce54a7-32e3-46df-bd7c-97f194ba4390</rd:DataSourceID>
    </DataSource>
  </DataSources>
  <DataSets> snip...
  </DataSets>
  <Body>
    <ReportItems>
      <Tablix Name="Tablix1">
        <TablixBody>
          <TablixColumns> snip...
          </TablixColumns>
          <TablixRows>
            <TablixRow>
              <Height>0.25in</Height>
              <TablixCells>
                <TablixCell>
                  <CellContents>
                    <Subreport Name="InvoiceFixedFeeDetail">
                      <ReportName>InvoiceFixedFeeDetail</ReportName>
                      <Parameters>
                        <Parameter Name="InvoicePageID">
                          <Value>=Fields!InvoicePageID.Value</Value>
                        </Parameter>
                      </Parameters>
                      <Style>
                        <Border>
                          <Style>None</Style>
                        </Border>
                      </Style>
                    </Subreport>
                    <ColSpan>3</ColSpan>
                  </CellContents>
                </TablixCell>
                <TablixCell />
                <TablixCell />
              </TablixCells>
            </TablixRow>
          </TablixRows>
        </TablixBody>
        <TablixColumnHierarchy>
          <TablixMembers>
            <TablixMember />
            <TablixMember />
            <TablixMember />
          </TablixMembers>
        </TablixColumnHierarchy>
        <TablixRowHierarchy>
          <TablixMembers>
            <TablixMember>
              <Group Name="Group1">
                <GroupExpressions>
                  <GroupExpression>=Fields!InvoicePageID.Value</GroupExpression>
                </GroupExpressions>
                <PageBreak>
                  <BreakLocation>StartAndEnd</BreakLocation>
                </PageBreak>
              </Group>
              <SortExpressions>
                <SortExpression>
                  <Value>=Fields!InvoicePageID.Value</Value>
                </SortExpression>
              </SortExpressions>
              <TablixHeader>
                <Size>0.03125in</Size>
                <CellContents>
                  <Textbox Name="Textbox11">
                    <CanGrow>true</CanGrow>
                    <CanShrink>true</CanShrink>
                    <KeepTogether>true</KeepTogether>
                    <Paragraphs>
                      <Paragraph>
                        <TextRuns>
                          <TextRun>
                            <Value />
                            <Style />
                          </TextRun>
                        </TextRuns>
                        <Style />
                      </Paragraph>
                    </Paragraphs>
                    <rd:DefaultName>Textbox11</rd:DefaultName>
                    <Style>
                      <Border>
                        <Color>LightGrey</Color>
                        <Style>None</Style>
                      </Border>
                    </Style>
                  </Textbox>
                </CellContents>
              </TablixHeader>
              <TablixMembers>
                <TablixMember>
                  <Group Name="Details">
                    <PageBreak>
                      <BreakLocation>StartAndEnd</BreakLocation>
                    </PageBreak>
                  </Group>
                  <TablixMembers>
                    <TablixMember />
                    <TablixMember />
                    <TablixMember />
                    <TablixMember />
                    <TablixMember />
                    <TablixMember />
                    <TablixMember />
                    <TablixMember />
                    <TablixMember />
                    <TablixMember />
                    <TablixMember />
                    <TablixMember />
                  </TablixMembers>
                </TablixMember>
              </TablixMembers>
            </TablixMember>
          </TablixMembers>
        </TablixRowHierarchy>
        <DataSetName>pages</DataSetName>
        <PageBreak>
          <BreakLocation>Start</BreakLocation>
        </PageBreak>
        <Height>3.45in</Height>
        <Width>6.38125in</Width>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
        </Style>
      </Tablix>
    </ReportItems>
    <Height>3.6in</Height>
    <Style>
      <Border>
        <Color>Green</Color>
        <Style>None</Style>
      </Border>
    </Style>
  </Body>
  <ReportParameters>
    <ReportParameter Name="InvoiceID">
      <DataType>Integer</DataType>
      <Prompt>ReportParameter1</Prompt>
    </ReportParameter>
    <ReportParameter Name="CustID">
      <DataType>String</DataType>
      <Prompt>ReportParameter1</Prompt>
    </ReportParameter>
  </ReportParameters>
  <Width>6.43125in</Width>
  <Page>
    <LeftMargin>1in</LeftMargin>
    <RightMargin>1in</RightMargin>
    <TopMargin>1in</TopMargin>
    <BottomMargin>1in</BottomMargin>
    <Style />
  </Page>
  <rd:ReportID>a360303c-713c-4baf-b9ce-32ae0997c855</rd:ReportID>
  <rd:ReportUnitType>Inch</rd:ReportUnitType>
</Report>


I have a partial answer, but it seems like a hack IMO. I'll leave this question open for a while to see if someone can suggest a better answer...

In order to force page breaks to appear where I wanted them, I eliminated the nested sub-reports by denormalizing the CLR dataset that was driving the main report. Then I used row groups on the main report to effect the page layout and set the checkboxes for "Between each instance" and "Also at the start" on the Page Breaks tab of the Group Properties dialog equivalent to the following setting in the RDLC xml:

            <PageBreak>
              <BreakLocation>Start</BreakLocation>
            </PageBreak>

I kept the grand-child entity (invoice lines) normalized out into their own dataset and sub-report because the column layout of the lines is significantly different than at the invoice header or invoice page level.


While this yields the desired layout, I'm not entirely satisfied with this answer because I don't like denormalizing the dataset. I want to examine how DataElementName works and whether that can yield a better solution.

Alternative answers are welcome

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜