Aspose.Diagram for Java logo

We’re pleased to announce that the new version 6.6.0 of Aspose.Diagram for Java API is now live. This new version adds features and provides the most notable and useful new APIs for application developers. It incorporates a way to access and modify code modules in the VBA project of Visio, read or convert macro-enabled Visio diagrams. Developers may also convert macro-enabled drawings to macro-free drawings and vice versa. Besides this, developers can manipulate OLE objects in the Visio diagram. We recommend our clients to use Aspose powerful Java APIs directly in their Maven Projects with simple configurations. For details on API fixes, please visit the product Release Notes section of this new version.

Change an OLE Object in Visio Diagram in Java

OLE (Object Linking and Embedding) is a technology that allows applications to share data and functionality easily in a quick way. OLE allows an application to interact with another one without knowing, in advance, about the other application. Aspose.Diagram API gives developers a mechanism to programmatically retrieve OLE objects from a Visio, and then change it with its modified version.

This help topic shows how to programmatically access an OLE object, and then change to another one: Manipulate the Embedded OLE Objects in Visio Diagram

Read or Convert VSDM, VSSM and VSTM Files

Microsoft Office Visio has three main file types named as drawing (VSDX), stencil (VSSX) and template (VSTX). It also offers macro-enabled formats (VSDM, VSSM and VSTM) for each file type. Using Aspose.Diagram API, it is very easy for developers to transform their macro-enable diagrams to macro-free diagrams or vice versa. However, please note, only the macro-enabled files (VSDM, VSSM, VSTM) can store VBA macros.

Edit Codebase in VBA Project of Visio

The VBA (Visual Basic Application) programs can be saved in the Microsoft Office Visio diagrams and VBA modules are the home for custom functions and subprocedures. Users may add multiple procedures in a single module manually. Using Aspose.Diagram API, developers can access and modify the source code of the whole module in the VBA project.

This help topic shows how to dynamically modify the VBA code segments: Modify VBA Module Code in Visio Diagram

Retrieve OLE Icons from a Visio

Users may embed documents on a Visio diagram, displayed as icons. Aspose.Diagram API allows developers to save these icons in the local storage.

String dirPath = "c:\\temp\\";
// load a Visio diagram
Diagram diagram = new Diagram(dirPath + "Drawing1.vsdx");
// get page of the Visio diagram by name
Page page = diagram.getPages().getPage("Page-1");
// get shape of the Visio diagram by ID
Shape OLE_Shape = page.getShapes().getShape(2);

// filter shapes by type Foreign
if (OLE_Shape.getType() == TypeValue.FOREIGN)
{
    if (OLE_Shape.getForeignData().getForeignType() == ForeignType.OBJECT)
    {
	// get byte array
    	byte[] bytes = OLE_Shape.getForeignData().getImageData();
    	// create an image file
    	FileOutputStream fos = new FileOutputStream(dirPath + "Icon_Out.png");
    	// write byte array of the image
    	fos.write(bytes);
    	// close array
    	fos.close();
    }
}

Public API Changes

The following API changes in the new version are also worth noting:

  • VSDM, VSSM and VSTM options are added to the LoadFileFormat Class.
  • VSDM, VSSM and VSTM options are added to the SaveFileFormat Class.
  • VbaModule, VbaModuleCollection, VbaProject, VbaProjectReference and VbaProjectReferenceCollection classes are added.
  • An getImageData() method is added to the ForeignData class

We auto port Aspose.Diagram for .NET to Java to give developers perfectly the same features on both platforms, so this version also incorporates the bug fixes and enhancements from its equivalent .NET version. Please check a list of the resolved defects:

  • Fixed: Add support to import the macro-enabled Drawing (VSDM).
  • Fixed: Add support to import the macro-enabled template (VSTM).
  • Fixed: Add support to import the macro-enabled stencil (VSSM).
  • Fixed: Diagram exception occurred while loading a VSDX file.

Aspose.Diagram for Java Resources

The following resources will help you work with Aspose.Diagram for Java:

We hope you’ll enjoy this new release that saves time and effort. The API is quite simple and developers can use it in application easily.

Intensity