public static void Set(IVisio.Shape shape, string name, string value, int type) { if (shape == null) { throw new ArgumentNullException(nameof(shape)); } CustomPropertyHelper.__CheckValidCustomPropertyName(name); if (value == null) { throw new ArgumentNullException(nameof(value)); } // create a new property var cp = new CustomPropertyCells(); cp.Value = value; cp.Type = type; CustomPropertyHelper.Set(shape, name, cp); }
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 = string.Format("Could not retrieve cell for custom property \"{0}\"", full_prop_name); throw new Exceptions.InternalAssertionException(msg); } var writer = new VisioAutomation.ShapeSheet.Writers.SrcWriter(); writer.SetValues(cp, cell_propname.Row); writer.CommitFormulas(shape); return; } short row = shape.AddNamedRow( vis_sec_prop, name, (short)IVisio.VisRowIndices.visRowProp); CustomPropertyHelper.Set(shape, row, cp); }