Saving image and coordinates to/from SQL Server Express

Hello ,

I can use Apose Diagram to create Visio like diagrams.

I want to save / retrieve diagrams and connectors to / from the database .

The diagram shall be like

What data types shall map from/ to Aspose Diagram .NET to/ fro SQL Server Express Edition .

Please let me know.


Hi Sujay,

Thank you for contacting support.

Well, you can create/modify the Visio drawings. I would like to update you that the VSS / VSX stencil file formats are a set of masters/templates which can be used these purposes. Masters should be present in the stencil. You can use the masters from any other diagram as well, but master names should match the masters present in the diagram or stencil. Furthermore, the AddShape method supports placing shapes on the Visio drawing pages.

Please refer to the Aspose.Diagram API example topics and other details:

Please feel free to reply us in case of any confusion or questions.

Hello Imran

My question was about saving and retrieving the drawings from the database. How does ASPOSE store the stencils. Should I save them as bitmaps (Working with Images|Documentation) to the database. Would it be the same way, I would store images in the database.

How do I store the connector lines .

Please let me know.


Hi Sujay,

Thank you for the clarification. Please note that you can save Visio stencil to the MemoryStream object. It allows us to get an array of bytes and then store the array of bytes into a database field. Please go through a sample help topic where we are saving a Word document to a Database field. You can adopt the same approach: How to Load and Save a Document to Database

Second, if you are saving stencil templates into the database, then no need to save image format of Visio shapes. It is simple to get the shapes from Visio stencil and include them in your existing or new Visio drawing. However, if you think it’s necessary, then you can get Bitmap format of each shape as follows and save it to a database field:

I hope, this covers all your points. Please free feel to reply us in case of any confusion or questions.

Hello Irfan

Thanks for the links and the explanation.

I want to save the entire drawing ( shapes and connectors ) at in the database, I would also like to retrieve it from the db after it has been saved

I understand the saving of the word document.
The following line populates the Doc field with the stream value.

// Add the @Doc parameter.
command.Parameters.AddWithValue(“Doc”, stream.ToArray());

What should be the preffered way of saving the entire image- should I save the entire image as a Memorystream or should I save the connector and the shapes differently . I think the latter is a bit cumbersome though.

Please suggest.


Hi Sujay,

Well, it’s all depend upon the scenario. In case the final output is an image format of a Visio drawing, then you can save the entire image as a MemoryStream object. It looks an easy approach.

We hope, this helps. Please let us know in case of any further assistance.