Exemplo n.º 1
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Creates a column definition object.</summary>
        /// <param name="tlmBase">Table layout manager of this column</param>
        /// <param name="rWidth">Width of the column (points, 1/72 inch)</param>
        internal TlmColumn(TlmBase tlmBase, Double rWidth)
        {
            tlmBase.CheckStatus_Init("cannot add columns.");
            this.tlmBase = tlmBase;
            cellDef      = new CellDef();
            iIndex       = tlmBase.al_TlmColumn.Count;
            tlmBase.al_TlmColumn.Add(this);

            if (rWidth <= 0)
            {
                throw new ReportException("Invalid value for the column width");
            }
            this.rWidth = rWidth;

            rBorderTop      = tlmBase.columnDef.rBorderTop;
            rBorderBottom   = tlmBase.columnDef.rBorderBottom;
            pp_BorderTop    = tlmBase.columnDef.pp_BorderTop;
            pp_BorderBottom = tlmBase.columnDef.pp_BorderBottom;
        }
Exemplo n.º 2
0
        private bool ParseCellDefs(string txt, bool opflag)
        {
            if (celldefs == null)
            {
                celldefs = new List <List <CellDef> >();
            }
            foreach (string columntext in txt.Split(",".ToCharArray()))
            {
                List <CellDef> column = new List <CellDef>();
                foreach (string celltext in columntext.Split("/".ToCharArray()))
                {
                    string[] def  = celltext.Split(":".ToCharArray());
                    CellDef  cell = new CellDef();
                    if (def.Length < 2)
                    {
                        cell.recordname  = "ERROR";
                        cell.recordid    = 99;
                        cell.displayname = "ERROR";
                        column.Add(cell);
                        continue;
                    }
                    cell.recordname  = def[0];
                    cell.recordid    = -1;
                    cell.displayname = def[1];
                    for (int i = 2; i < def.Length; i++)
                    {
                        if (def[i].Length == 0)
                        {
                            continue;
                        }
                        string param = def[i].Substring(1);
                        switch (def[i][0])
                        {
                        case 'W':
                            cell.width = StringUtil.ToInt(param);
                            break;

                        case 'P':
                            cell.decoration = CellDef.Decoration.PAREN;
                            break;

                        case 'G':
                            cell.decoration = CellDef.Decoration.LTGT;
                            break;

                        case 'I':
                            cell.style = CellDef.Style.SUBINFO;
                            break;

                        case 'O':
                            cell.style = CellDef.Style.OPERATION;
                            break;

                        case 'D':
                            if (param.Length == 0)
                            {
                                break;
                            }
                            switch (param[0])
                            {
                            case 'S':
                                cell.dateformat = CellDef.DateFormat.SHORT;
                                break;

                            case 'N':
                                cell.dateformat = CellDef.DateFormat.NOYEAR;
                                break;

                            case 'D':
                                cell.dateformat = CellDef.DateFormat.DATEONLY;
                                break;
                            }
                            break;

                        case 'K':
                            cell.strikeout = param;
                            break;

                        case 'S':
                            if (param.Length == 0)
                            {
                                break;
                            }
                            switch (param[0])
                            {
                            case 'A':
                                cell.sortable = CellDef.Sortable.ASCEND;
                                break;

                            case 'D':
                                cell.sortable = CellDef.Sortable.DESCEND;
                                break;
                            }
                            break;

                        case 'T':
                            cell.tooltip = param;
                            break;
                        }
                    }
                    if ((cell.style != CellDef.Style.OPERATION) || opflag)
                    {
                        column.Add(cell);
                    }
                }
                if (column.Count > 0)
                {
                    celldefs.Add(column);
                }
            }
            return(true);
        }