/// <summary>constructor /// </summary> /// <param name="reportFirstPageHeader"></param> /// <param name="reportFooter">page header for first page</param> /// <param name="reportNextPageHeader">page header for second and next pages, if null then page header for first page is used</param> public ReportDocument(HeaderFooterBase reportFirstPageHeader, HeaderFooterBase reportFooter, HeaderFooterBase reportNextPageHeader = null) { m_ReportFirstPageHeader = reportFirstPageHeader; m_ReportNextPageHeader = (reportNextPageHeader ?? m_ReportFirstPageHeader); m_ReportFooter = reportFooter; m_FixedDocument = new FixedDocument(); m_FixedDocument.DocumentPaginator.PageSize = new Size(ReportPage.DisplayResolution * ReportPage.PageWidth, ReportPage.DisplayResolution * ReportPage.PageHeight); m_CurrentReportPage = new ReportPage(m_ReportFirstPageHeader, m_ReportFooter); m_FixedDocument.Pages.Add(m_CurrentReportPage.PageContent); m_CurrentReportPage.UpdatePageLayout(); }
public MultiPageDocument(HeaderFooterBase reportFirstPageHeader, HeaderFooterBase reportNextPageHeader = null) { this.m_ReportFirstPageHeader = reportFirstPageHeader; this.m_ReportNextPageHeader = (reportNextPageHeader ?? m_ReportFirstPageHeader); this.m_FixedDocument = new FixedDocument(); this.m_FixedDocument.DocumentPaginator.PageSize = new Size(ReportPage.DisplayResolution * ReportPage.PageWidth, ReportPage.DisplayResolution * ReportPage.PageHeight); PageNumberFooter pageNumberFooter = new PageNumberFooter(1); this.m_CurrentReportPage = new ReportPage(m_ReportFirstPageHeader, pageNumberFooter); this.m_FixedDocument.Pages.Add(m_CurrentReportPage.PageContent); this.m_CurrentReportPage.UpdatePageLayout(); }
/// <summary>default constructor /// </summary> /// <param name="header">page header object</param> /// <param name="footer">page footer object</param> public ReportPage(HeaderFooterBase header, HeaderFooterBase footer) { PageContent = new PageContent(); FixedPage = new FixedPage() { Background = Brushes.White, Width = m_DisplayResolution * m_PageWidth, Height = m_DisplayResolution * m_PageHeight }; ((IAddChild)PageContent).AddChild(FixedPage); m_HeaderGrid = new Grid(); m_FooterGrid = new Grid(); BodyGrid = XPSHelper.GetGrid(0, 1); header.Write(m_HeaderGrid); footer.Write(m_FooterGrid); WriteItemToPage(m_HeaderGrid, m_PageTopMargin, m_PageTopMargin); WriteItemToPage(BodyGrid, m_PageLeftMargin, m_HeaderGrid.ActualHeight / m_DisplayResolution + m_HeaderToBodyGap); WriteItemToPage(m_FooterGrid, m_PageLeftMargin, double.MinValue, double.MinValue, m_PageBottomMargin); }