public static void Set(IVisio.Shape shape, short row, CustomPropertyCells cp) { if (shape == null) { throw new ArgumentNullException(nameof(shape)); } var writer = new VisioAutomation.ShapeSheet.Writers.SrcWriter(); cp.SetFormulas(writer, row); writer.Commit(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 = string.Format("Could not retrieve cell for custom property \"{0}\"", full_prop_name); throw new InternalAssertionException(msg); } var writer = new VisioAutomation.ShapeSheet.Writers.SrcWriter(); cp.SetFormulas(writer, cell_propname.Row); writer.Commit(shape); return; } short row = shape.AddNamedRow( (short)IVisio.VisSectionIndices.visSectionProp, name, (short)IVisio.VisRowIndices.visRowProp); CustomPropertyHelper.Set(shape, row, cp); }