As requested I’ve attached a sample Visio file and added some code fragments below to illustrate what we’re doing. Please let me know if you need further information.
Private Sub TestSRCCell(ByVal objDirInfo As DirectoryInfo)
For Each objFileIO As FileInfo In objDirInfo.GetFiles("" & fileExtension) 'loop through all files with the relevant extension
currentFilename = objFileIO.FullName
Dim map As New Aspose.Diagram.Diagram(objFileIO.FullName)
For Each page As Aspose.Diagram.Page In map.Pages
For Each shape As Aspose.Diagram.Shape In page.Shapes
'add prop
Dim prop As New Aspose.Diagram.Prop
prop.Del = Aspose.Diagram.BOOL.True
prop.ID = PROP_ID
prop.NameU = PROP_NAMEU_VALUE
prop.Name = PROP_NAME_VALUE
shape.Props.Add(prop)
Next
Next
map.Save(objFileIO.FullName, Aspose.Diagram.SaveFileFormat.VSDM)
Next
End Sub
Private Sub VerifySRCCell(ByVal objDirInfo As DirectoryInfo)
For Each objFileIO As FileInfo In objDirInfo.GetFiles("" & fileExtension) 'loop through all files with the relevant extension
currentFilename = objFileIO.FullName
Dim map As New Aspose.Diagram.Diagram(objFileIO.FullName)
For Each page As Aspose.Diagram.Page In map.Pages
For Each shape As Aspose.Diagram.Shape In page.Shapes
'check props
Dim prop As New Aspose.Diagram.Prop
prop = shape.Props.GetProp(PROP_NAME_VALUE)
If prop.Del <> Aspose.Diagram.BOOL.True Then
WriteToLog(“Test Fail (PROP del mismatch). Shape name=” & shape.Name & " Map name=" & objFileIO.FullName)
End If
If prop.ID <> PROP_ID Then
WriteToLog(“Test Fail (PROP ID mismatch). Shape name=” & shape.Name & " Map name=" & objFileIO.FullName)
End If
If prop.NameU <> PROP_NAMEU_VALUE Then
WriteToLog(“Test Fail (PROP NameU mismatch). Shape name=” & shape.Name & " Map name=" & objFileIO.FullName)
End If
Next
Next
Next
End Sub