Get/ Set User Shape data in Visio 2013 with C#

1.4k views Asked by At

I would like to get / set my shape data properties in C# of my own object or an already created object with some shape data defined.

Data=shape.Cells["User.Level"].ToString();

I have tried this and no result. Also this:

Data=shape.Cells["Prop.Level"].FormulaU="1";

Can anyone provide the right code?

1

There are 1 answers

1
ronconsoda On BEST ANSWER

Finally I have solved this way. Forever alone!

private void GetValueOfCustomShapeData(Shape shape, string LabelToSearch)
{
  short iRow = (short)VisRowIndices.visRowFirst;

  // While there are stil rows to look at.
  while (shape.get_CellsSRCExists((short)VisSectionIndices.visSectionProp,iRow,(short)VisCellIndices.visCustPropsValue,(short)0) != 0)
  {
    // Get the label and value of the current property.
    string label = shape.get_CellsSRC(
                          (short)VisSectionIndices.visSectionProp,
                          iRow,
                          (short)VisCellIndices.visCustPropsLabel
                          ).get_ResultStr(VisUnitCodes.visNoCast);

    string value = shape.get_CellsSRC(
                           (short)VisSectionIndices.visSectionProp,
                           iRow,
                           (short)VisCellIndices.visCustPropsValue
                           ).get_ResultStr(VisUnitCodes.visNoCast);

    string strProperties = shape.Name + " - " + label + " - " + value;

    MessageBox.Show(strProperties);

    // Move to the next row in the properties
    section.iRow++;
}