Free Support Forum - aspose.com

Efficient loading of shapes from master shape library

Hey there,


thanks for fixing all my issues so far. I’m finally able to generate Visio diagrams :slight_smile:

Which brings me to my next question. When generating a Vision diagram, I need about 5-10 master shapes which are currently part of a big VSS file which contains my library of about 600 master shapes. Loading that VSS file takes quite a bit of time though (up to a minute) and is rather inefficient if I only need a handful of shapes out of all those master shapes. Is there a better way to load only the shapes that I need?

Possible ideas:
  • Save to master shape objects to SQL database and retrieving them later
    Serialization seems to be impossible right now (according to some forum posts)
  • Keeping the VSS file in the IIS web server memory
    Not really an option, since there is a memory limit on the IIS server which is way below my requirements

Unfortunately, reducing the number of shapes or reducing the number of sub-shapes isn’t an option either and the shape library will probably grow in the future.

Greetings

Tim

Hi Tim,


Thank you for contacting support. Well, you can split the big stencil file by classifying handy shapes according to the requirement and save them to small multiple stencil files. We don’t recommend to manipulate so large stencil file. However, if it is not feasible in your scenario, then please let us know how you are adding masters in the Diagram class object. You can add master as follows:

[.NET, C#]
// Load diagram
Diagram diagram = new Diagram();

// Load stencil to a stream
string templateFileName = “c:\temp\master.vss”;

// Add master with stencil file path and master id
string masterName = “Star”;
diagram.AddMaster(templateFileName, 2);


// Add master with stencil file path and master name
diagram.AddMaster(templateFileName, masterName);

Is the AddMaster method, taking time on your end? Please provide us your complete source code and stencil file for testing purposes. We'll investigate it and reply you accordingly.

We're looking forward to help you.

Hey there,


I fixed this issue by splitting the stencil file apart. Now, instead of one file with 600 master shapes, I have 600 files with one master shape each. This allows me to load only those shapes that I really need. Visio generation time has been reduced from 90 seconds to 4 seconds.

Thanks for your help, Imran :slight_smile:

Hi Tim,


Thank you for the confirmation. It is nice to hear from you that you managed it. Please feel free to ask if you require any further assistance in reference of Aspose APIs, we will be happy to help you.