We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Technique to save diagram to user's local drive

It appears that the DiagramModel.Save method is able to save a diagram's XML to the machine on which the application is running. That is all I have seen, in the samples I have found so far.

In my case, the application will be running on a web server.  Is there a technique by which the diagram's XML can be saved to an individual user's local drive?


5 Replies

SG Shyam G Syncfusion Team May 8, 2014 01:01 PM UTC

Hi Jeff,

We are currently working on your requirement. We will update you the status on 5/12/2014.

Please let me know if any concerns.

Regards,

Shyam G



JE Jeff May 8, 2014 02:31 PM UTC

Thank you, Shyam.  

If there is no easy solution with existing functionality, here is what I would suggest for a future feature:

  1. A DiagramModel method that returns the model XML as a string.  That way, I can do whatever I like with the XML. 
  2. A DiagramModel method to which I can supply the XML as a string.  This could be an overload of the DiagramModel.Load method, or a new DiagramModel method.

With the two methods I describe above, one that sets the XML string for, and one that gets the XML string from, the DiagramModel, I have ultimately flexibility.  I can save and load the XML to/from a local file on the user's system, a blob in Azure Storage, a database column, etc.



SG Shyam G Syncfusion Team May 9, 2014 01:07 PM UTC

 

Hi Jeff,

Diagram is serialized using DiagramModel.Save method, it take file name with full path as its argument as shown in the following code snippet.

Code Snippet:

diagramView.Model.Save(“D:\\filepath\fileName.xml”);

Once this function is executed, a diagram will be serialized and stored in the given file path. Later you can read this file in application level for further processing.       

Currently we don’t have support to get serialized object as a string. We have considered this as feature requestOption to get the serialized diagram as a string , and we have created an incident 124771 however to access this, we request you to login to your direct Trac account to view this incident for more details. 

Our Direct Trac support system can be accessed from the following link: 

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents 

Please let me know if any concerns. 

Regards,

Shyam G



JE Jeff May 9, 2014 04:07 PM UTC

Thank you for your efforts, and for creating the incident related to a feature request.  My comments re: the "option to get the serialized diagram as a string" are a suggestion for future feature improvements.

 

However, my immediate need is to write, and then read, a diagram's XML file to/from a location other than the server's file system.  Since my application will be hosted with a PaaS provider, there is no file space for me to write to except the file space of the application itself.  As you can imagine, that space is very limited. 

 

Is the only option to use DiagramModel.Save and DiagramModel.Load, to write to and then read from the server's file system?



SG Shyam G Syncfusion Team May 13, 2014 11:52 AM UTC

Hi Jeff

Thanks for the update.

We have two option to use DiagramModel.Load and DiagramModel.Save method. One is XML file and another is MemoryStream.

Using XML File:

DiagramModel.Save and DiagramModel.Load methods allows you to save to and then load from the server file system.

Using MemoryStream:

DiagramModel.Save and DiagramModel.Load methods allows you to save to and then load from the memory, As already discussed, we consider saving and loading through string variable as a feature request.

Please let me know if any concerns.

Regards,

Shyam G


Loader.
Live Chat Icon For mobile
Up arrow icon