コード例 #1
0
ファイル: RdCells.cs プロジェクト: zhaoxf101/Friend
        public void ReBuild()
        {
            this.Clear();
            RdCell _cell       = null;
            bool   _styleFount = false;

            for (int i = 0; i <= this.Document.Rows.RowCount; i++)
            {
                for (int j = 0; j <= this.Document.Columns.ColumnCount; j++)
                {
                    _cell       = this.Document.GetCell(i, j);
                    _styleFount = false;
                    foreach (KeyValuePair <int, RdStyle> value in this.m_list)
                    {
                        bool flag = Utils.StyleRecEqual(value.Value.GetStyle(), _cell.Style);
                        if (flag)
                        {
                            value.Value.List.Add(value.Value.List.Count, _cell);
                            _styleFount = true;
                            break;
                        }
                    }
                    bool flag2 = !_styleFount;
                    if (flag2)
                    {
                        RdStyle _style = new RdStyle(this.Document);
                        _style.Id = this.m_list.Count + 1;
                        _style.List.Add(_style.List.Count, _cell);
                        this.m_list.Add(this.m_list.Count + 1, _style);
                    }
                }
            }
        }
コード例 #2
0
        internal override void Load(XmlNode node)
        {
            RdMergeCellsStyle _curStyle = new RdMergeCellsStyle();

            Utils.StyleRecLoad(node, ref _curStyle, base.Document.DefaultStyle);
            this.LoadEmptyCells(node, _curStyle);
            bool hasChildNodes = node.HasChildNodes;

            if (hasChildNodes)
            {
                for (XmlNode cellNode = node.FirstChild; cellNode != null; cellNode = cellNode.NextSibling)
                {
                    bool flag = cellNode.Name == "Cell";
                    if (flag)
                    {
                        int  _rowNo    = Utils.GetAttrInt(cellNode, "Row", -1);
                        int  _columnNo = Utils.GetAttrInt(cellNode, "Column", -1);
                        bool flag2     = _rowNo > base.Document.Rows.RowCount;
                        if (flag2)
                        {
                            base.Document.Rows.RowCount = _rowNo;
                        }
                        bool flag3 = _columnNo > base.Document.Columns.ColumnCount;
                        if (flag3)
                        {
                            base.Document.Columns.ColumnCount = _columnNo;
                        }
                        RdCell _cell = base.Document.GetCell(_rowNo, _columnNo);
                        bool   flag4 = _cell == null;
                        if (flag4)
                        {
                            break;
                        }
                        bool flag5 = _cell != null;
                        if (flag5)
                        {
                            _cell.Load(cellNode);
                        }
                        bool flag6 = _cell.HiddenBy == null;
                        if (flag6)
                        {
                            RdMergeCellsStyle tmpStyle = new RdMergeCellsStyle();
                            Utils.CopyStyleRec(ref tmpStyle, _curStyle);
                            _cell.Style = tmpStyle;
                        }
                        bool flag7 = _cell.Height > 1 && _rowNo + _cell.Height - 1 > base.Document.Rows.RowCount;
                        if (flag7)
                        {
                            base.Document.Rows.RowCount = _rowNo + _cell.Height - 1;
                        }
                        bool flag8 = _cell.Width > 1 && _columnNo + _cell.Width - 1 > base.Document.Columns.ColumnCount;
                        if (flag8)
                        {
                            base.Document.Columns.ColumnCount = _columnNo + _cell.Width - 1;
                        }
                    }
                }
            }
        }
コード例 #3
0
ファイル: RdCells.cs プロジェクト: zhaoxf101/Friend
        public int GetCellStyleID(RdCell cell)
        {
            int ret = -1;

            foreach (KeyValuePair <int, RdStyle> value in this.m_list)
            {
            }
            return(ret);
        }
コード例 #4
0
 internal RdCell(RdDocument document, int row, int column) : base(document)
 {
     this.m_row        = row;
     this.m_column     = column;
     this.m_value      = "";
     this.m_width      = 1;
     this.m_height     = 1;
     this.m_hiddenBy   = null;
     this.m_affectedBy = new List <string>();
 }
コード例 #5
0
        public void AdjustRowCount(int rowCount, bool copyFromRowHeader)
        {
            int  _curRowCount = this.m_cells.Count - 1;
            bool flag         = rowCount < 0;

            if (!flag)
            {
                bool flag2 = _curRowCount > rowCount;
                if (flag2)
                {
                    for (int i = rowCount + 1; i <= _curRowCount; i++)
                    {
                        bool flag3 = this.m_cells.ContainsKey(i);
                        if (flag3)
                        {
                            this.m_cells.Remove(i);
                        }
                    }
                }
                else
                {
                    for (int j = _curRowCount + 1; j <= rowCount; j++)
                    {
                        RdCell            _cell    = new RdCell(base.Document, j, this.Column);
                        RdMergeCellsStyle tmpStyle = new RdMergeCellsStyle();
                        bool flag4 = j == 0 && this.Column == 0;
                        if (flag4)
                        {
                            Utils.CopyStyleRec(ref tmpStyle, base.Document.DefaultStyle);
                            _cell.Style = tmpStyle;
                        }
                        else
                        {
                            bool flag5 = j == 0 || this.Column == 0;
                            if (flag5)
                            {
                                Utils.CopyStyleRec(ref tmpStyle, base.Document.GetCell(0, 0).Style);
                                _cell.Style = tmpStyle;
                            }
                            else if (copyFromRowHeader)
                            {
                                Utils.CopyStyleRec(ref tmpStyle, base.Document.GetCell(j, 0).Style);
                                _cell.Style = tmpStyle;
                            }
                            else
                            {
                                Utils.CopyStyleRec(ref tmpStyle, base.Document.GetCell(0, this.Column).Style);
                                _cell.Style = tmpStyle;
                            }
                        }
                        this.m_cells.Add(j, _cell);
                    }
                }
            }
        }
コード例 #6
0
        public RdCell GetCell(int rowIndex)
        {
            RdCell ret  = null;
            bool   flag = rowIndex >= 0 && rowIndex < this.m_cells.Count;

            if (flag)
            {
                ret = this.m_cells[rowIndex];
            }
            return(ret);
        }
コード例 #7
0
        internal void CopyNode(ref RdCell node)
        {
            node.Name = base.Name;
            node.Tag  = base.Tag;
            RdMergeCellsStyle tmpStyle = new RdMergeCellsStyle();

            Utils.CopyStyleRec(ref tmpStyle, base.Style);
            node.Style       = tmpStyle;
            node.Width       = this.Width;
            node.Height      = this.Height;
            node.Value       = this.Value;
            node.Result      = this.Result;
            node.GeneratedBy = this.GeneratedBy;
        }
コード例 #8
0
        public static string ReportDifference(string reportXml, string priorReportXml)
        {
            string     result     = string.Empty;
            RdDocument repPrior   = new RdDocument();
            RdDocument repCurrent = new RdDocument();

            repPrior.SetReport(priorReportXml);
            repCurrent.SetReport(reportXml);
            for (int rowIndex = 1; rowIndex <= repCurrent.Rows.RowCount; rowIndex++)
            {
                for (int columnIndex = 1; columnIndex <= repCurrent.Columns.ColumnCount; columnIndex++)
                {
                    RdCell cellPrior   = repPrior.GetCell(rowIndex, columnIndex);
                    RdCell cellCurrent = repCurrent.GetCell(rowIndex, columnIndex);
                    bool   flag        = cellPrior == null || cellPrior.GetAsString() != cellCurrent.GetAsString();
                    if (flag)
                    {
                        cellCurrent.SetColor(Color.Red);
                    }
                }
            }
            return(repCurrent.GetReport());
        }
コード例 #9
0
        public static string GetReportCellResult(string reportXml, int rowIndex, int columnIndex)
        {
            string     result = string.Empty;
            RdDocument doc    = new RdDocument();

            doc.SetReport(reportXml);
            RdCell cell = doc.GetCell(rowIndex, columnIndex);
            bool   flag = cell != null;

            if (flag)
            {
                bool flag2 = cell.AutoDataType == RdDataType.dtFormula;
                if (flag2)
                {
                    result = cell.GetAsText();
                }
                else
                {
                    result = cell.GetAsString();
                }
            }
            return(result);
        }
コード例 #10
0
ファイル: RmImages.cs プロジェクト: zhaoxf101/Friend
        internal RdImage NewImage(RdDocument doc, RdCell computeCell, ArrayList paramList)
        {
            RdImage result  = new RdImage(doc);
            RdCell  curCell = (RdCell)computeCell.Data;

            result.Left   = computeCell.Column;
            result.Top    = computeCell.Row;
            result.Right  = computeCell.Column + curCell.Width - 1;
            result.Bottom = computeCell.Row + curCell.Height - 1;
            string imgPath      = string.Empty;
            string imgAlignment = string.Empty;
            bool   flag         = paramList.Count == 1;

            if (flag)
            {
                imgPath = paramList[0].ToString();
            }
            else
            {
                bool flag2 = paramList.Count == 2;
                if (flag2)
                {
                    imgPath      = paramList[0].ToString();
                    imgAlignment = paramList[1].ToString();
                }
            }
            bool    flag3 = string.IsNullOrEmpty(imgPath);
            RdImage result2;

            if (flag3)
            {
                result2 = null;
            }
            else
            {
                Image img = Image.FromFile(imgPath);
                result.Name    = imgPath.Substring(imgPath.LastIndexOf('\\') + 1);
                result.Width   = img.Width;
                result.Height  = img.Height;
                result.Preview = true;
                result.Print   = true;
                byte[] graphic = File.ReadAllBytes(imgPath);
                result.GrdphicStr = Convert.ToBase64String(graphic);
                string a = imgAlignment;
                if (!(a == "L"))
                {
                    if (!(a == "R"))
                    {
                        if (!(a == "C"))
                        {
                            result.HAlignment   = RdHAlignment.haCenter;
                            result.ImageControl = RdImageControl.icStretch;
                        }
                        else
                        {
                            result.HAlignment   = RdHAlignment.haCenter;
                            result.ImageControl = RdImageControl.icAlign;
                        }
                    }
                    else
                    {
                        result.HAlignment   = RdHAlignment.haRight;
                        result.ImageControl = RdImageControl.icAlign;
                    }
                }
                else
                {
                    result.HAlignment   = RdHAlignment.haLeft;
                    result.ImageControl = RdImageControl.icAlign;
                }
                result.VAlignment  = RdVAlignment.vaCenter;
                result.Transparent = false;
                bool flag4 = img.RawFormat.Guid == ImageFormat.Bmp.Guid;
                if (flag4)
                {
                    result.Type = RdImageType.itBitmap;
                }
                else
                {
                    bool flag5 = img.RawFormat.Guid == ImageFormat.Emf.Guid;
                    if (flag5)
                    {
                        result.Type = RdImageType.itEMF;
                    }
                    else
                    {
                        result.Type = RdImageType.itJPEG;
                    }
                }
                curCell.SetHAlignment(RdHAlignment.haRight);
                curCell.SetVAlignment(RdVAlignment.vaTop);
                result2 = result;
            }
            return(result2);
        }
コード例 #11
0
ファイル: RmImages.cs プロジェクト: zhaoxf101/Friend
 internal RdImage GenChartImage(RdDocument doc, RdCell computeCell, ArrayList paramList)
 {
     return(null);
 }
コード例 #12
0
 public RmVars(RdCell cell)
 {
     this.m_cell = cell;
 }
コード例 #13
0
ファイル: RdImages.cs プロジェクト: zhaoxf101/Friend
        internal RdImage NewImage(RdDocument doc, RdCell computeCell, ArrayList paramList, byte[] graphicValue)
        {
            RdImage result = new RdImage(doc);

            result.Left   = computeCell.Column;
            result.Top    = computeCell.Row;
            result.Right  = computeCell.Column + computeCell.Width - 1;
            result.Bottom = computeCell.Row + computeCell.Height - 1;
            string imgPath      = string.Empty;
            string imgAlignment = string.Empty;
            bool   flag         = paramList.Count == 1;

            if (flag)
            {
                imgPath = paramList[0].ToString();
            }
            else
            {
                bool flag2 = paramList.Count == 2;
                if (flag2)
                {
                    imgPath      = paramList[0].ToString();
                    imgAlignment = paramList[1].ToString();
                }
            }
            bool    flag3 = string.IsNullOrEmpty(imgPath);
            RdImage result2;

            if (flag3)
            {
                result2 = null;
            }
            else
            {
                result.Name       = imgPath.Substring(imgPath.LastIndexOf('\\') + 1);
                result.Width      = 532;
                result.Height     = 333;
                result.Preview    = true;
                result.Print      = true;
                result.GrdphicStr = Convert.ToBase64String(graphicValue);
                string a = imgAlignment;
                if (!(a == "L"))
                {
                    if (!(a == "R"))
                    {
                        if (!(a == "C"))
                        {
                            result.HAlignment   = RdHAlignment.haCenter;
                            result.ImageControl = RdImageControl.icStretch;
                        }
                        else
                        {
                            result.HAlignment   = RdHAlignment.haCenter;
                            result.ImageControl = RdImageControl.icAlign;
                        }
                    }
                    else
                    {
                        result.HAlignment   = RdHAlignment.haRight;
                        result.ImageControl = RdImageControl.icAlign;
                    }
                }
                else
                {
                    result.HAlignment   = RdHAlignment.haLeft;
                    result.ImageControl = RdImageControl.icAlign;
                }
                result.VAlignment  = RdVAlignment.vaCenter;
                result.Transparent = false;
                result.Type        = RdImageType.itEMF;
                computeCell.SetHAlignment(RdHAlignment.haRight);
                computeCell.SetVAlignment(RdVAlignment.vaTop);
                result2 = result;
            }
            return(result2);
        }