Shape text is not visible when adding a new shape

I’ve been trying to add various shapes to a diagram and have encountered a situation where shape text of a newly added shape is not visible on the diagram.

To demonstrate this I’ve attached 2 diagrams:
Map1.vsdm contains a rectangular shape in the bottom left with the text Test Activity. This shape was added programmatically using Aspose and is correct.

Map2.vsdm contains the same shape in the bottom left which was added using the same code. However, the shape text is not visible and the warning triangle is misshapen.

Thanks,
Andrew
Hi Andrew,

Thank you for contacting support. We are working over your query and will get back to you soon.

Hi Andrew,

Thank you for being patient.
andrew.ridgeley:
Map1.vsdm contains a rectangular shape in the bottom left with the text Test Activity. This shape was added programmatically using Aspose and is correct.

Map2.vsdm contains the same shape in the bottom left which was added using the same code. However, the shape text is not visible and the warning triangle is misshapen.
You have sent output VSDM drawings. We require your input VSDM drawings and code which you are running to add this corner shape. Your response is awaited.

Hi Imran


As requested, I’ve attached copies of the files before they were altered programmatically.

The code used to make the changes is shown below.

Please let me know if you need any further information.

Regards,
Andrew

Private Const ACTIVITY_TEXT As String = “TEST ACTIVITY”
Private Const DELIVERABLE_TEXT As String = “TEST DELIVERABLE”
Private Const HYPERLINK_ADDRESS As String = “https://www.triaster.co.uk
Private Const HYPERLINK_DESCRIPTION As String = “Description is Triaster Website”
Private Const HYPERLINK_NAME As String = “NameisTriasterWebsite”
Private Const ACTIVITY_MASTER_NAME As String = “Activity”
Private Const HYPERLINK_MASTER_NAME As String = “Hyperlink circle 1”
Private Const DELIVERABLE_MASTER_NAME As String = “Deliverable”

Private Sub TestShapeAdd(ByVal objDirInfo As DirectoryInfo)
'recurses through all Visio files within folder and sub-folders
'opens map, adds shapes, saves map
're-opens map and checks shapes have been saved with correct values


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
'add activity
Dim myActivity As New Aspose.Diagram.Shape()
Dim myActivityText As New Aspose.Diagram.Txt(ACTIVITY_TEXT)
page.AddShape(myActivity, ACTIVITY_MASTER_NAME)
myActivity.Text.Value.Clear()
myActivity.Text.Value.Add(myActivityText)

'add deliverable
Dim myDeliverable As New Aspose.Diagram.Shape()
Dim myDeliverableText As New Aspose.Diagram.Txt(DELIVERABLE_TEXT)
page.AddShape(myDeliverable, DELIVERABLE_MASTER_NAME)
myDeliverable.Text.Value.Clear()
myDeliverable.Text.Value.Add(myDeliverableText)

'add hyperlink
Dim myHyperlinkShape As New Aspose.Diagram.Shape
Dim myHyperlink As New Aspose.Diagram.Hyperlink
myHyperlink.Address.Value = HYPERLINK_ADDRESS
myHyperlink.Description.Value = HYPERLINK_DESCRIPTION
myHyperlink.Name = HYPERLINK_NAME
myHyperlinkShape.Hyperlinks.Add(myHyperlink)
page.AddShape(myHyperlinkShape, HYPERLINK_MASTER_NAME)

Next

map.Save(objFileIO.FullName, Aspose.Diagram.SaveFileFormat.VSDM)
Next

For Each objSubDirInfo As DirectoryInfo In objDirInfo.GetDirectories()
TestShapeAdd(objSubDirInfo)
Next
End Sub

Hi Andrew,


Thank you for sending source drawings and code. We managed to replicate the problem of invisible text and a warning triangle inside the shape. It has been logged under ticket ID DIAGRAMNET-51233 in our bug tracking system. We have also linked your post to this ticket and will let you know, once the significant progress has been made. We are sorry for the inconvenience caused.

Hi Andrew,


In reference to the ticket ID DIAGRAMNET-51233, the master named as “Activity” is different between the both VSDM drawings (“map1.vsdm” & “map2.vsdm”), since the shapes are not same. We will address the problems with invisible text and misshapen warning triangle.

However, if you are seeking to replicate the same “Activity” shape from Map1.vsdm to Map2.vsdm drawing, then you can remove “Activity” master from the “Map2.vsdm” drawing. Once it is removed then you can add “Activity” master to Map2.vsdm drawing from Map1.vsdm drawing. Aspose.Diagram API allows to add masters from other Visio drawings as well as the stencil files.

When we tried to remove the “Activity” master from Map2.vsdm drawing, and then added a new “Activity” master from Map1.vsdm drawing. It was throwing an error and we had also logged this problem under the ticket ID DIAGRAMNET-51234. We have resolved this ticket and its fix will be included in the next version 17.5 of Aspose.Diagram API. We will let you know once the next version 17.5 is available. Sample code:

[.NET, VB.NET]
<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>Dim map2 As New Aspose.Diagram.Diagram(“C:\Diagram\test2044\map2.vsdm”) <span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
<span class=“str” style=“color: rgb(0, 96, 128); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>’ remove Activity master
For Each master As Aspose.Diagram.Master In map2.Masters
If master.Name = “Activity” Then
act_master = master
End If
Next
map2.Masters.Remove(act_master)
‘<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”> add Activity master from map1.vsdm <span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
map2.AddMaster(“C:\Diagram\test2044\map1.vsdm”, “Activity”) <br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“color: rgb(0, 96, 128); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>’ place a new activity shape here and then save VSDM drawing<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
map2.Save(“C:\Diagram\test2044\map2_out.vsdm”, SaveFileFormat.VSDM)
<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>

The issues you have found earlier (filed as DIAGRAMNET-51234) have been fixed in Aspose.Diagram for .NET 17.5.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

@andrew.ridgeley,
In reference to the ticket ID DIAGRAMNET-51233, if you require to delete the warning triangle, please use this sample code after loading the drawing:

[C#]

Master master =map.Masters.GetMasterByName(ACTIVITY_MASTER_NAME); 
master.Shapes[0].Shapes.GetShape(27).Text.Value.Clear(); 
master.Shapes[0].Shapes.GetShape(27).Geoms.Clear(); 
foreach (Page page in map.Pages) 
{ 
    Shape myActivity = new Shape(); 
    Txt myActivityText = new Txt(ACTIVITY_TEXT);              
    page.AddShape(myActivity, ACTIVITY_MASTER_NAME); 
}

Best Regards,
Imran Rafique