/// <summary>method return new grid spreaded to full report width with columns of same width /// </summary> /// <param name="rowCount">rows count</param> /// <param name="colCount">columns count</param> /// <param name="leftMargin">optional horizontal (left and right) margin</param> /// <returns>new grid</returns> public static Grid GetGridWithEqualColumns(int rowCount, int colCount, double leftMargin = 0, double topMargin = 0) { double colWidth = (ReportPage.ReportWidth * ReportPage.DisplayResolution - 2 * leftMargin) / (colCount * ReportPage.DisplayResolution); List <double> colWidths = new List <double>(); for (int i = 0; i < colCount; i++) { colWidths.Add(colWidth); } Grid grid = XPSHelper.GetGrid(colWidths.ToArray(), rowCount); grid.Margin = new Thickness(leftMargin, topMargin, 0, 0); return(grid); }
/// <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); }