/// <summary> /// 获取内部指定位置的文本 /// </summary> /// <param name="p_row"></param> /// <param name="p_col"></param> /// <returns></returns> public RptText GetText(int p_row, int p_col) { TblRangeType tblType = GetRangeType(p_row, p_col); switch (tblType) { case TblRangeType.Header: { return(Header.Rows[p_row - Header.Row].Cells[p_col - Col]); } case TblRangeType.Group: { foreach (RptTblGroup grp in Groups) { if (grp.Header != null) { int hRow = grp.Header.Row; if (hRow <= p_row && p_row < hRow + grp.Header.RowSpan) { return(grp.Header.Rows[p_row - hRow].Cells[p_col - Col]); } } if (grp.Footer != null) { int fRow = grp.Footer.Row; if (fRow <= p_row && p_row < fRow + grp.Footer.RowSpan) { return(grp.Footer.Rows[p_row - fRow].Cells[p_col - Col]); } } } return(null); } case TblRangeType.Body: { return(Body.Rows[p_row - Body.Row].Cells[p_col - Col]); } case TblRangeType.Footer: { return(Footer.Rows[p_row - Footer.Row].Cells[p_col - Col]); } case TblRangeType.Outer: default: return(null); } }
internal void LoadForms(RptItem p_item, CellRange p_range) { if (p_item == null || p_range == null) { return; } _curItem = p_item; if (p_item is RptText txt) { LoadCellForm(txt); _tabItem.Content = null; _tabCell.IsSelected = true; return; } if (p_item is RptTable tbl) { txt = tbl.GetText(p_range.Row, p_range.Column); LoadCellForm(txt); if (_fmTbl == null) { _fmTbl = new TableForm(Info); } TblRangeType tblRng = tbl.GetRangeType(p_range.Row, p_range.Column); _fmTbl.LoadItem(txt, tblRng == TblRangeType.Group); _tabItem.Content = _fmTbl; return; } if (p_item is RptMatrix mtx) { txt = mtx.GetText(p_range.Row, p_range.Column); LoadCellForm(txt); MtxRangeType mtxRng = mtx.GetRangeType(p_range.Row, p_range.Column); switch (mtxRng) { case MtxRangeType.Level: if (_fmMtxLevel == null) { _fmMtxLevel = new MatrixLevelForm(Info); } _fmMtxLevel.LoadItem(txt); _tabItem.Content = _fmMtxLevel; break; case MtxRangeType.Subtotal: if (_fmMtxSubtotal == null) { _fmMtxSubtotal = new MatrixSubtotalForm(Info); } _fmMtxSubtotal.LoadItem(txt); _tabItem.Content = _fmMtxSubtotal; break; case MtxRangeType.Subtitle: if (_fmMtxSubtitle == null) { _fmMtxSubtitle = new MatrixSubtitleForm(Info); } _fmMtxSubtitle.LoadItem(txt); _tabItem.Content = _fmMtxSubtitle; break; default: if (_fmMatrix == null) { _fmMatrix = new MatrixForm { Info = Info } } ; _fmMatrix.LoadItem(mtx); _tabItem.Content = _fmMatrix; break; } return; } if (p_item is RptChart chart) { if (_fmChart == null) { _fmChart = new ChartForm(Info); } _fmChart.LoadItem(chart); _tabItem.Content = _fmChart; _tabCell.Content = null; _tabItem.IsSelected = true; } }