We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Wrong Values for Shape.getName(), Shape.getNameU()

In some cases we observe (with Aspose Diagram 21.9.0 for Java), that the results of



don’t match the results of VBA Shape.Name and Shape.NameU respectively.

I enclosed a small example (wrong-name-example.vsd) with just two shapes.

For the shape with id 63 and Aspose Diagram 21.9 we get:

Shape.getName(): ”Sheet.63”

Shape.getNameU(): ””

In Visio and via VBA we see

Name: ”Wand 2.4”

NameU: ”Wand 2.4”

The locale should match in both cases.

If we save the file in the vsdx format, we also get these correct values with Aspose Diagram.

Mentioned example file:

wrong-name-example.zip (10.4 KB)


We tried to test the scenario in our environment using 22.4 version of the API and faced an exception. However, we have logged all these details under the ticket DIAGRAMJAVA-50936 in our issue tracking system for further investigation. We will look into its details and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

Thanks for the quick response.
I don’t get any exception when accessing the names of the two shapes (and some other information) in the file with version 21.9. I guess, I don’t have access to your ticket system.
Let me know, if I should retry with a different version or provide additional information.


The ticket has been logged in our internal issue management system and you will not be able to access it. However, we will keep you posted in this forum thread about ticket status. Furthermore, could you please try using the latest version and share the sample code snippet with us that you are using to get the shape properties?

Below is the code; nothing fancy, it just gets all the shapes on the page (including shapes in groups) and prints their names. I get the same result with Aspose 22.4 (no exception, output:

Page Blatt-1, ID:5
shape: id:1451, name:Sheet.1451, nameu:
shape: id:63, name:Sheet.63, nameu:


import java.util.;
import java.io.

import com.aspose.diagram.*;

public class Bug {
public static void addShapes(ArrayList res, Shape shape) {
ShapeCollection shapes= shape.getShapes();
for (Object s0 : shapes) {
addShapes(res, (Shape)s0);

public static ArrayList<Shape> getShapes(Page page) {
	ArrayList<Shape> res= new ArrayList<Shape>();

	ShapeCollection shapes= page.getShapes();
	for (Object s0 : shapes) {
		addShapes(res, (Shape)s0);			
	return res;		

public static void debugShapes(Diagram diagram) throws Exception {		
	PageCollection pages= diagram.getPages();
	for (Object p0 : pages) {
		Page page= (Page)p0;
		System.out.println("Page "+page.getName()+", ID:"+page.getID());
		for (Object s0 : getShapes(page)) {
			Shape shape= (Shape)s0;
			System.out.println("shape: id:"+shape.getID()+", name:"+shape.getName()+", nameu:"+shape.getNameU());
public static void main(String[] args) throws Exception {
	String filename= args[0];
	FileInputStream fin= new FileInputStream(filename);
	LoadOptions loadOptions = new LoadOptions();
	Diagram diagram = new Diagram(fin, loadOptions);


Here is a screenshot of the dialog “Shape-Name” for the shape with id 63:

2022-04-20 23_08_10-Visio Professional.png (7.8 KB)


Thanks for providing the additional details. We were now able to replicate the issue in our environment by testing the scenario using your provided code snippet. Therefore, the ticket information has been updated accordingly. We will further let you know when some progress is made towards issue resolution. Please spare us some time.

Ok, great.
Thanks again for starting to work on this within hours!

1 Like

The issues you have found earlier (filed as DIAGRAMJAVA-50936) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou

Thanks, for the testfile it is working correctly now. We will run some more extensive checks later.

1 Like