Beispiel #1
0
        private static void EnsureTwoColumns(Shape shape, string cellName)
        {
            Table table = Common.GetCellTable(shape, cellName);

            if (!table.IsEmpty())
            {
                while (table.GetNumColumns() < 2)
                {
                    table.AddColumn();
                }
                Common.SetCellTable(shape, cellName, table);
            }
        }
Beispiel #2
0
        public static Table GetTableFromRows(BindingList <NameValuePairRow> rows)
        {
            Table table = new Table(rows.Count, Enum.GetNames(typeof(TableColumns.NameValuePairs)).Length);

            Boolean newStartStep = false;

            //Version 1.6.1.13+ uses a new set of fields for init data NV pairs - Notes column was added JDK 08-25-2014
            if (table.GetNumColumns() >= 5)
            {
                newStartStep = true;
            }

            if (newStartStep)
            {
                int row = 0;
                foreach (NameValuePairRow nv in rows)
                {
                    table.SetData(row, (int)TableColumns.NameValuePairs.Name, nv.Name);
                    table.SetData(row, (int)TableColumns.NameValuePairs.Value, nv.Value);
                    table.SetData(row, (int)TableColumns.NameValuePairs.Notes, nv.Notes);
                    table.SetData(row, (int)TableColumns.NameValuePairs.NameDateStamp, nv.NameDateStamp);
                    table.SetData(row, (int)TableColumns.NameValuePairs.ValueDateStamp, nv.ValueDateStamp);
                    table.SetData(row, (int)TableColumns.NameValuePairs.NotesDateStamp, nv.NotesDateStamp);
                    row++;
                }
            }
            else
            {
                int row = 0;
                foreach (NameValuePairRow nv in rows)
                {
                    table.SetData(row, (int)TableColumns.NameValuePairs.Name, nv.Name);
                    table.SetData(row, (int)TableColumns.NameValuePairs.Value, nv.Value);
                    //table.SetData(row, (int)TableColumns.NameValuePairs.Notes, nv.Notes);
                    table.SetData(row, (int)TableColumns.NameValuePairs.NameDateStamp, nv.NameDateStamp);
                    table.SetData(row, (int)TableColumns.NameValuePairs.ValueDateStamp, nv.ValueDateStamp);
                    //table.SetData(row, (int)TableColumns.NameValuePairs.NotesDateStamp, nv.NotesDateStamp);
                    row++;
                }
            }
            return(table);
        }
Beispiel #3
0
        public static BindingList <NameValuePairRow> GetRowsFromTable(Table table)
        {
            BindingList <NameValuePairRow> list = new BindingList <NameValuePairRow>();

            Boolean newStartStep = false;

            //Version 1.6.1.13+ uses a new set of fields for init data NV pairs - Notes column was added JDK 08-25-2014
            if (table.GetNumColumns() >= 5)
            {
                newStartStep = true;
            }

            if (newStartStep)
            {
                for (int r = 0; r < table.GetNumRows(); r++)
                {
                    NameValuePairRow nv = new NameValuePairRow();
                    nv.Name           = table.GetData(r, (int)TableColumns.NameValuePairs.Name);
                    nv.Value          = table.GetData(r, (int)TableColumns.NameValuePairs.Value);
                    nv.Notes          = table.GetData(r, (int)TableColumns.NameValuePairs.Notes);
                    nv.NameDateStamp  = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp);
                    nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp);
                    nv.NotesDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NotesDateStamp);
                    list.Add(nv);
                }
            }
            else
            {
                for (int r = 0; r < table.GetNumRows(); r++)
                {
                    NameValuePairRow nv = new NameValuePairRow();
                    nv.Name           = table.GetData(r, (int)TableColumns.NameValuePairs.Name);
                    nv.Value          = table.GetData(r, (int)TableColumns.NameValuePairs.Value);
                    nv.Notes          = "";
                    nv.NameDateStamp  = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp);
                    nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp);
                    nv.NotesDateStamp = "";
                    list.Add(nv);
                }
            }
            return(list);
        }
        public static BindingList<NameValuePairRow> GetRowsFromTable(Table table)
        {
            BindingList<NameValuePairRow> list = new BindingList<NameValuePairRow>();

            Boolean newStartStep = false;
            //Version 1.6.1.13+ uses a new set of fields for init data NV pairs - Notes column was added JDK 08-25-2014
            if (table.GetNumColumns() >= 5)
            {
                newStartStep = true;
            }

            if (newStartStep)
            {
                for (int r = 0; r < table.GetNumRows(); r++)
                {
                    NameValuePairRow nv = new NameValuePairRow();
                    nv.Name = table.GetData(r, (int)TableColumns.NameValuePairs.Name);
                    nv.Value = table.GetData(r, (int)TableColumns.NameValuePairs.Value);
                    nv.Notes = table.GetData(r, (int)TableColumns.NameValuePairs.Notes);
                    nv.NameDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp);
                    nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp);
                    nv.NotesDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NotesDateStamp);
                    list.Add(nv);
                }
            } else {
                for (int r = 0; r < table.GetNumRows(); r++)
                {
                    NameValuePairRow nv = new NameValuePairRow();
                    nv.Name = table.GetData(r, (int)TableColumns.NameValuePairs.Name);
                    nv.Value = table.GetData(r, (int)TableColumns.NameValuePairs.Value);
                    nv.Notes = "";
                    nv.NameDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp);
                    nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp);
                    nv.NotesDateStamp = "";
                    list.Add(nv);
                }
            }
            return list;
        }
Beispiel #5
0
        // changes fields which are A$$B to be A
        private static void FixDollarDollarTableFields(Shape shape, string cellName)
        {
            const string dataSeparator = "$$";

            Table table = Common.GetCellTable(shape, cellName);

            if (!table.IsEmpty())
            {
                for (int r = 0; r < table.GetNumRows(); r++)
                {
                    for (int c = 0; c < table.GetNumColumns(); c++)
                    {
                        string data = table.GetData(r, c);
                        if (data.Contains(dataSeparator))
                        {
                            data = data.Substring(0, data.IndexOf(dataSeparator));
                            table.SetData(r, c, data);
                        }
                    }
                }
                Common.SetCellTable(shape, cellName, table);
            }
        }
        public static Table GetTableFromRows(BindingList<NameValuePairRow> rows)
        {
            Table table = new Table(rows.Count, Enum.GetNames(typeof(TableColumns.NameValuePairs)).Length);

            Boolean newStartStep = false;
            //Version 1.6.1.13+ uses a new set of fields for init data NV pairs - Notes column was added JDK 08-25-2014
            if (table.GetNumColumns() >= 5)
            {
                newStartStep = true;
            }

            if (newStartStep)
            {
                int row = 0;
                foreach (NameValuePairRow nv in rows)
                {
                    table.SetData(row, (int)TableColumns.NameValuePairs.Name, nv.Name);
                    table.SetData(row, (int)TableColumns.NameValuePairs.Value, nv.Value);
                    table.SetData(row, (int)TableColumns.NameValuePairs.Notes, nv.Notes);
                    table.SetData(row, (int)TableColumns.NameValuePairs.NameDateStamp, nv.NameDateStamp);
                    table.SetData(row, (int)TableColumns.NameValuePairs.ValueDateStamp, nv.ValueDateStamp);
                    table.SetData(row, (int)TableColumns.NameValuePairs.NotesDateStamp, nv.NotesDateStamp);
                    row++;
                }
            }
            else
            {
                int row = 0;
                foreach (NameValuePairRow nv in rows)
                {
                    table.SetData(row, (int)TableColumns.NameValuePairs.Name, nv.Name);
                    table.SetData(row, (int)TableColumns.NameValuePairs.Value, nv.Value);
                    //table.SetData(row, (int)TableColumns.NameValuePairs.Notes, nv.Notes);
                    table.SetData(row, (int)TableColumns.NameValuePairs.NameDateStamp, nv.NameDateStamp);
                    table.SetData(row, (int)TableColumns.NameValuePairs.ValueDateStamp, nv.ValueDateStamp);
                    //table.SetData(row, (int)TableColumns.NameValuePairs.NotesDateStamp, nv.NotesDateStamp);
                    row++;
                }
            }
            return table;
        }