All shapes of visio file not being read in

Hi,

Java_Visio.zip (303.0 KB)

I am using the Diagram Java package to read all shapes and textual content of a visio file that contains a flowchart within some Swimlane and vertical Separator component. The program is able to read the shapes of the Swimlanes and Separator but unable to get to the Flowchart Shapes and Textual Content in them.

What could be the possible cause of this?

Java code method snippet provided below -

public static void GetShapeText(Shape shape) {
	// filter shape text

	System.out.println("\nShape ID : " + shape.getID());
	System.out.println("Name : " + shape.getName());
	System.out.println("Master Shape : " + shape.getMaster().getName());
	System.out.println("Shape member layer : " + shape.getLayerMem().getLayerMember().getValue());

	String txt = "";

	if (shape.getText().getValue().getText() != "") {
		txt = (shape.getText().getValue().getText().replaceAll("\\<.*?>", ""));
		System.out.println("Text from shape added : " + txt);
		text += txt;
	}

	// for image shapes
	if (shape.getType() == TypeValue.FOREIGN)
		text += (shape.getName());

	// for group shapes
	if (shape.getType() == TypeValue.GROUP)
		for (Shape subshape : (Iterable<Shape>) shape.getShapes()) {
			GetShapeText(subshape);
		}

}

@srikmukh

We are looking into the scenario and will get back to you shortly.

Dear Asad,

Were you able to make some headway into the issue being faced? Is that a ASPOSE Java library issue?

Regards,
Srikanta

@srikmukh

Thanks for your patience.

We have tested the scenario using Aspose.Diagram for Java 19.8 and obtained following output. Would you please check it and point out the missing values which API was unable to extract from your shared diagram. We will further proceed to assist you accordingly.

extracteddata.zip (2.8 KB)

Hi Asad,

Your program Aspose.Diagram for Java 19.8 has been able to extract all the connector and process steps perfectly. The version I used was not able to get the processes under Swimlanes and Separators. Can you kindly send me across the Aspose Java package that you used for the purpose of extraction?

Regards,
Srikanta

Hi Asad, I just realized that I was also using Aspose.Diagram Java 19.8.0. Could you please send across the source file that you used to extract the information as I believe that there is a difference in the source code that I shared with you and the one you have used.

Attaching my .java file that I have used for my text extraction and GetShapeText() is the core method which does the extraction in a recursive fashion.

Regards,
SrikantaVSDReaderTest.zip (1.9 KB)

@srikmukh

We have tested the scenario after modifying/simplifying the code snippet shared by you earlier. Following is the code snippet which was used for testing and produced shared results:

try {
     com.aspose.diagram.Diagram diagram = new com.aspose.diagram.Diagram(dataDir + "Example-Cross-Functional-Flow-Chart-Diagram.vsd");
     for (com.aspose.diagram.Shape shape : (Iterable<com.aspose.diagram.Shape>) diagram.getPages().getPage(0).getShapes()) {
      // Display information about the shapes
      System.out.println("\nShape ID : " + shape.getID());
      System.out.println("Name : " + shape.getName());
      System.out.println("Master Shape : " + shape.getMaster().getName());
      String txt = "";

      if (shape.getText().getValue().getText() != "") {
       txt = (shape.getText().getValue().getText().replaceAll("\\<.*?>", ""));
       System.out.println("Text from shape added : " + txt);
       txt += txt;
      }

      // for image shapes
      if (shape.getType() == com.aspose.diagram.TypeValue.FOREIGN)
         txt += (shape.getName());

         // for group shapes
         if (shape.getType() == com.aspose.diagram.TypeValue.GROUP)
          for (com.aspose.diagram.Shape subshape : (Iterable<com.aspose.diagram.Shape>) shape.getShapes()) {
            if (subshape.getText().getValue().getText() != "") {
               txt = (subshape.getText().getValue().getText().replaceAll("\\<.*?>", ""));
               System.out.println("Text from shape added : " + txt);
               txt += txt;
             }

             // for image shapes
             if (subshape.getType() == com.aspose.diagram.TypeValue.FOREIGN)
                 txt += (subshape.getName());
             }

          }
 }catch (Exception ex){
            ex.printStackTrace();
}