Exemplo n.º 1
0
        /// <summary>
        /// 将此单元格的位置用I3MergeRange表示
        /// 为合并单元格的第一个单元格时,返回整个合并区间
        /// 为合并单元格的其他单元格时,只返回单元格本身
        /// </summary>
        public I3MergeRange GetRange_Mode2(I3ReportData reportData)
        {
            I3MergeRange range = this.MergState == I3MergeState.FirstCell ? reportData.GetMergeRange(row, col) : null;

            if (range == null)
            {
                range = new I3MergeRange((short)row, (short)col, (short)row, (short)col);
            }
            return(range);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 将此单元格的位置用I3MergeRange表示
        /// 为合并单元格时,返回合并区域
        /// </summary>
        public I3MergeRange GetRange_Mode1(I3ReportData reportData)
        {
            I3MergeRange range = null;

            switch (this.MergState)
            {
            case I3MergeState.Merged:
                I3ReportCell startCell = reportData.GetMergedStartedCell(this.Row, this.Col);
                range = reportData.GetMergeRange(startCell.Row, startCell.Col);
                break;

            case I3MergeState.FirstCell:
                range = reportData.GetMergeRange(this.Row, this.Col);
                break;

            default:
                range = new I3MergeRange((short)this.Row, (short)this.Col, (short)this.Row, (short)this.Col);
                break;
            }

            return(range);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 重新计算单元格的大小,借以调整行、列的大小
        /// prepareNarrow:是否处理内容缩放
        /// </summary>
        /// <param name="reportData"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        private static void ReCalCellSize(I3ReportData reportData, int row, int col, bool prepareNarrow)
        {
            #region 获取单元格、样式、合并区域对象
            I3ReportCell cell = reportData.GetCellItem(row, col);
            if (cell == null || cell.MergState == I3MergeState.Merged)  //单元格为空,或者是被合并的,不需要重新计算
            {
                return;
            }
            I3ReportCellStyle style = reportData.GetCellStyle(cell.StyleName); //没有样式设置,不用重新计算
            if (style == null)
            {
                return;
            }
            I3MergeRange range = cell.MergState == I3MergeState.FirstCell ? reportData.GetMergeRange(row, col) : null;
            if (range == null)
            {
                range = new I3MergeRange((short)row, (short)col, (short)row, (short)col);
            }
            #endregion

            #region 得到默认宽度、高度
            int width  = 0;
            int height = 0;
            for (int i = range.StartRow; i <= range.EndRow; i++)
            {
                height += reportData[i].Height;
            }
            for (int i = range.StartCol; i <= range.EndCol; i++)
            {
                width += reportData.Cols[i].Width;
            }
            if (width == 0 || height == 0)
            {
                return;
            }
            #endregion


            II3CellRenderer renderer = I3CellRendererBuilder.GetRenderer(reportData[row][col]);
            SizeF           needSize = renderer.CalCellNeedSize(width, height, style, cell);
            if (needSize != SizeF.Empty)
            {
                renderer.AdjustCellSize(width, height, needSize, style, cell, range, reportData, prepareNarrow);
            }
        }