示例#1
0
        public static List <Dictionary <string, UserDefinedCellCells> > GetDictionary(IVisio.Page page, IList <IVisio.Shape> shapes, ShapeSheet.CellValueType type)
        {
            if (page == null)
            {
                throw new System.ArgumentNullException(nameof(page));
            }

            if (shapes == null)
            {
                throw new System.ArgumentNullException(nameof(shapes));
            }

            var shapeids = shapes.Select(s => s.ID).ToList();

            var list_list_customprops = UserDefinedCellCells.GetCells(page, shapeids, CellValueType.Formula);

            var list_dic_customprops = new List <Dictionary <string, UserDefinedCellCells> >(shapeids.Count);

            for (int shape_index = 0; shape_index < shapes.Count; shape_index++)
            {
                var shape            = shapes[shape_index];
                var list_customprops = list_list_customprops[shape_index];
                var prop_names       = UserDefinedCellHelper.GetNames(shape);

                var dic_customprops = new Dictionary <string, UserDefinedCellCells>(list_customprops.Count);
                list_dic_customprops.Add(dic_customprops);
                for (int i = 0; i < list_customprops.Count; i++)
                {
                    var prop_name = prop_names[i];
                    dic_customprops[prop_name] = list_customprops[i];
                }
            }

            return(list_dic_customprops);
        }
示例#2
0
        public static Dictionary <string, UserDefinedCellCells> GetDictionary(IVisio.Shape shape, ShapeSheet.CellValueType type)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            var prop_count = UserDefinedCellHelper.GetCount(shape);

            if (prop_count < 1)
            {
                return(new Dictionary <string, UserDefinedCellCells>(0));
            }

            var prop_names = UserDefinedCellHelper.GetNames(shape);

            if (prop_names.Count != prop_count)
            {
                throw new InternalAssertionException("Unexpected number of prop names");
            }

            var shape_data = UserDefinedCellCells.GetCells(shape, type);

            var dic = new Dictionary <string, UserDefinedCellCells>(prop_count);

            for (int i = 0; i < prop_count; i++)
            {
                dic[prop_names[i]] = shape_data[i];
            }
            return(dic);
        }