public static void Set(IVisio.Shape shape, string name, ShapeSheet.FormulaLiteral value, ShapeSheet.FormulaLiteral prompt)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            UserDefinedCellsHelper.CheckValidName(name);

            if (UserDefinedCellsHelper.Contains(shape, name))
            {
                string full_prop_name = UserDefinedCellsHelper.GetRowName(name);

                if (value.HasValue)
                {
                    string value_cell_name = full_prop_name;
                    var cell = shape.CellsU[value_cell_name];
                    cell.FormulaU = value.Encode();                    
                }

                if (prompt.HasValue)
                {
                    string prompt_cell_name = full_prop_name+".Prompt";
                    var cell = shape.CellsU[prompt_cell_name];
                    cell.FormulaU = prompt.Encode();                                        
                }
                return;
            }

            short row = shape.AddNamedRow(
                UserDefinedCellsHelper._userdefinedcell_section,
                name,
                (short)IVisio.VisRowIndices.visRowUser);

            var update = new ShapeSheet.Update();

            if (value.HasValue)
            {
                var src = new ShapeSheet.SRC(UserDefinedCellsHelper._userdefinedcell_section, row, (short)IVisio.VisCellIndices.visUserValue);
                update.SetFormula(src, value.Encode());
            }

            if (prompt.HasValue)
            {
                var src = new ShapeSheet.SRC(UserDefinedCellsHelper._userdefinedcell_section, row, (short)IVisio.VisCellIndices.visUserPrompt);
                update.SetFormula(src, prompt.Encode());
            }

            update.Execute(shape);
        }
        public static void Set(
            IVisio.Shape shape,
            string name,
            CustomPropertyCells cp)
        {
            if (shape == null)
            {
                throw new ArgumentNullException(nameof(shape));
            }

            CustomPropertyHelper.CheckValidCustomPropertyName(name);

            if (CustomPropertyHelper.Contains(shape, name))
            {
                string full_prop_name = CustomPropertyHelper.GetRowName(name);
                var cell_propname = shape.CellsU[full_prop_name];

                if (cell_propname == null)
                {
                    string msg = $"Could not retrieve cell for custom property \"{full_prop_name}\"";
                    throw new AutomationException(msg);
                }

                var update = new ShapeSheet.Update();
                update.SetFormulas(cp, cell_propname.Row);
                update.Execute(shape);

                return;

            }

            short row = shape.AddNamedRow(
                (short)IVisio.VisSectionIndices.visSectionProp,
                name,
                (short)IVisio.VisRowIndices.visRowProp);

            CustomPropertyHelper.Set(shape, row, cp);
        }
        public static void Set(IVisio.Shape shape, string name, string value, string prompt)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException("shape");
            }

            CheckValidName(name);

            if (Contains(shape, name))
            {
                string full_prop_name = GetRowName(name);

                if (value != null)
                {
                    string value_cell_name = full_prop_name;
                    var cell = shape.CellsU[value_cell_name];
                    string value_formula = Convert.StringToFormulaString(value);
                    cell.FormulaU = value_formula;
                }

                if (prompt != null)
                {
                    string prompt_cell_name = full_prop_name+".Prompt";
                    var cell = shape.CellsU[prompt_cell_name];
                    var prompt_formula = Convert.StringToFormulaString(prompt);
                    cell.FormulaU = prompt_formula;
                }
                return;
            }

            short row = shape.AddNamedRow(
                _userdefinedcell_section,
                name,
                (short)IVisio.VisRowIndices.visRowUser);

            var update = new VA.ShapeSheet.Update();

            if (value != null)
            {
                string value_formula = Convert.StringToFormulaString(value);
                var src = new VA.ShapeSheet.SRC(_userdefinedcell_section, row, (short)IVisio.VisCellIndices.visUserValue);
                update.SetFormula(src, value_formula);
            }

            if (prompt != null)
            {
                string prompt_formula = Convert.StringToFormulaString(prompt);
                var src = new VA.ShapeSheet.SRC(_userdefinedcell_section, row, (short)IVisio.VisCellIndices.visUserPrompt);
                update.SetFormula(src, prompt_formula);
            }

            update.Execute(shape);
        }