예제 #1
0
        public object Clone()
        {
            SimpleArrayList al = new SimpleArrayList();

            foreach (string key in this)
            {
                al.Add(key);
            }
            return(al);
        }
예제 #2
0
        public Cell GetByGroupKeyWhenCheckGroup(string mapname)
        {
            Cell            c        = null;
            SimpleArrayList mapnames = new SimpleArrayList();

            foreach (Cell cell in this)
            {
                if (cell.Name.ToLower() == mapname.ToLower() || ((cell is IMapName) && (cell as IMapName).MapName.ToLower() == mapname.ToLower()))
                {
                    if (cell is GridProportionDecimal)//占比列不能作为分组 add by yanghx 2012-6-30
                    {
                        continue;
                    }
                    c = cell;
                    if (c is IMapName && (c as IMapName).MapName.ToLower() != mapname.ToLower())
                    {
                        mapnames.Add((c as IMapName).MapName);
                    }
                    if (c is IGridCollect && (c as IGridCollect).bSummary)
                    {
                        (c as IGridCollect).bSummary = false;
                    }
                    break;
                }
                else if (cell is IGridCollect && (cell as IGridCollect).bSummary && (cell as IGridCollect).Operator == OperatorType.ExpressionSUM && ExpressionSumContains(cell, mapname))
                {
                    (cell as IGridCollect).bSummary = false;
                }
            }
            foreach (string mp in mapnames)
            {
                foreach (Cell cell in this)
                {
                    if (cell.Name.ToLower() == mp.ToLower() || ((cell is IMapName) && (cell as IMapName).MapName.ToLower() == mp.ToLower()))
                    {
                        if (cell is IGridCollect && (cell as IGridCollect).bSummary)
                        {
                            (cell as IGridCollect).bSummary = false;
                        }
                    }
                    else if (cell is IGridCollect && (cell as IGridCollect).bSummary && (cell as IGridCollect).Operator == OperatorType.ExpressionSUM && ExpressionSumContains(cell, mp))
                    {
                        (cell as IGridCollect).bSummary = false;
                    }
                }
            }
            return(c);
        }
        private void CreateDataTable(Section pagetitle)//from pagetitle,designcaption=null, to be x; ____ to be none; a___b to be two new columns; others to be a new column
        {
            _captiontoname             = new SimpleHashtable();
            _designcaptiontodesignname = new SimpleHashtable();
            _designcaptiontodesignname.Add("__bcross__", _currentreport.Type == ReportType.CrossReport);
            _currenttable = new DataTable((_currentmetrix as Cell).Name);
            AddATableColumn("X", new SimpleArrayList(), typeof(string), null, null);
            _data.Tables.Add(_currenttable);

            foreach (Cell cell in pagetitle.Cells)
            {
                if (cell is Label)
                {
                    Label l = cell as Label;
                    if (l.DesignCaption != "____")
                    {
                        if (l is SuperLabel)
                        {
                            foreach (Label sl in (l as SuperLabel).Labels)
                            {
                                if (!string.IsNullOrEmpty(sl.DesignCaption) && sl.DesignCaption != "____")
                                {
                                    AddATableColumn(l.Caption + "____" + sl.Caption, sl.Name, typeof(decimal), sl.Caption, sl.DesignName);
                                }
                                //AddATableColumn(l.DesignCaption + "____" + sl.DesignCaption, sl.Name, typeof(decimal), sl.DesignCaption, sl.DesignName);
                            }
                        }
                        else if (string.IsNullOrEmpty(l.DesignCaption))//x
                        {
                            SimpleArrayList sal = _captiontoname["X"] as SimpleArrayList;
                            sal.Add(l.Name);
                        }
                        else
                        {
                            AddATableColumn(l.Caption, l.Name, typeof(decimal), l.Caption, l.DesignName);
                            //AddATableColumn(l.DesignCaption, l.Name, typeof(decimal), l.DesignCaption, l.DesignName);
                        }
                    }
                }
            }
        }
예제 #4
0
        public void FillFrom(Report report)
        {
            if (_report != null)
            {
                _report.BaseTable = report.BaseTable;
            }
            _grouplevels = report.GroupLevels;
            if (!string.IsNullOrEmpty(report.BaseTable))
            {
                _tablenamecollection.Add(report.BaseTable);
                if (!_levelcollection.Contains(report.BaseTable) || _grouplevels > (int)_levelcollection[report.BaseTable])
                {
                    _levelcollection.Add(report.BaseTable, _grouplevels);
                }
            }
            if (!string.IsNullOrEmpty(report.RawTable))
            {
                _tablenamecollection.Add(report.RawTable);
            }
            if (!string.IsNullOrEmpty(report.CrossTable))
            {
                _tablenamecollection.Add(report.CrossTable);
            }

            if (report.bFromCache)
            {
                if (report.bPageByGroup)
                {
                    _pages = report.RowsCount == 0 ? 1 : report.RowsCount;
                }
                else
                {
                    _pages = report.PageRecords == 0 ? 1 : (report.RowsCount / report.PageRecords + (report.RowsCount % report.PageRecords == 0 ? 0 : 1));
                }
                _report.RowsCount   = report.RowsCount;
                _report.GroupsCount = report.GroupsCount;
                return;
            }

            if (_report != null)
            {
                _report.Dispose();
                _report = null;
            }
            _report = report;
            _type   = _report.Type;

            if (string.IsNullOrEmpty(_viewid))
            {
                _viewid = _report.ViewID;
            }
            if (!string.IsNullOrEmpty(_colorid))
            {
                _report.ColorStyleID = _colorid;
            }
            if (_showstyle == ShowStyle.None)
            {
                if (!_report.bNoneCross && _report.CurrentCrossSchema != null)
                {
                    if (_report.CurrentCrossSchema.CrossRowGroup != null)
                    {
                        _showstyle = _report.CurrentCrossSchema.CrossRowGroup.ShowStyle;
                    }
                    else
                    {
                        _showstyle = _report.CurrentCrossSchema.ShowStyle; //为了升级兼容
                    }
                }
                else
                {
                    _showstyle = _report.CurrentSchema.ShowStyle;
                }
            }

            //自由报表合并单元格--2
            //if (_type == ReportType.FreeReport)
            //    _report.CurrentSchema.ShowStyle = (_report.FreeViewStyle == FreeViewStyle.MergeCell ? ShowStyle.NoGroupHeader : ShowStyle.Normal);

            _bshowdetail = report.bShowDetail;

            _pageindex = 0;
            if (_report.bPageByGroup)
            {
                _pages = _report.RowsCount == 0 ? 1 : _report.RowsCount;
            }
            else
            {
                _pages = _report.PageRecords == 0?1:(_report.RowsCount / _report.PageRecords + (_report.RowsCount % _report.PageRecords == 0 ? 0 : 1));
            }

            if (_report.bIndicator)
            {
                return;
            }

            using (Graphics g = Row.CreateGraphics())
            {
                _report.TransformFromInchOfHandredToPixel(g);
            }

            foreach (Section section in report.Sections)
            {
                section.Cells.SetSuper();
            }

            #region RedrawReportHeader
            Section header = _report.Sections[SectionType.ReportHeader];
            if (header != null)
            {
                foreach (Cell cell in header.Cells)
                {
                    if (cell is Expression && cell.Visible)
                    {
                        if ((cell as Expression).Formula.FormulaExpression == "Page()" ||
                            (cell as Expression).Formula.FormulaExpression == "Pages()")
                        {
                            _dynamiccontentonheader = true;
                            if (_report.ReportHeaderOption != ReportHeaderPrintOption.NotPint)
                            {
                                _report.ReportHeaderOption = ReportHeaderPrintOption.EveryPage;
                            }
                        }
                    }
                }
            }
            #endregion
        }