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

Save a diagram in SQLServer and show in a .rdl report

Hi,

I would like to save a diagram in SQLServer (2016) and retrieve this data for use in a .rdl report, do you have any suggestion for these 2 operations for which I have not found documentation on suggested format and expression to use in RDL report to show this diagram

Thank you in advance! - Nicolas

7 Replies

NG Naganathan Ganesh Babu Syncfusion Team October 3, 2016 12:43 PM UTC

Hi Nicolas, 
 
Thanks for contacting Syncfusion support. 
 
In Diagram control, there is no built in support to generate the .rdl report retrieving data from the database. However, we have created a sample to generate the .rdl report. Please check the sample and let us know whether the sample achieves your requirement or not? 
 
Sample: 
 
 
Regards, 
 
Naganathan K G 



NI Nicolas October 3, 2016 07:46 PM UTC

Hi, I was not able to open the mdf file, but when I check the code, I see that only the raw data is used in the rdlc report. I might not have been clear in my initial query, I would like to see the actual diagram in the rdl report. So what is the best, to save in XML or EDD in SQL server (I believe we can only save the XML in the server)? Once the diagram data is saved in the server, I guess again we'll need to use an image item (or something else) to load the diagram through an expression? - Nicolas


NG Naganathan Ganesh Babu Syncfusion Team October 4, 2016 09:39 AM UTC

Hi Nicolas, 
 
Could you please confirm us whether your need is to save/load the diagram as XML format from/to the database? If so, please use Diagram’s “SaveSoap()” and “LoadSoap()” methods to export the diagram in XML format as shown below. 
 
Code example: 
 
[C#] 
 
//Save diagram as XML format 
diagram1.SaveSoap(@"..//..//diagram.xml"); 
//Load diagram  
diagram1.LoadSoap(@"..//..//diagram.xml"); 
 
If we misunderstood your requirement, please share us more details about your requirement on retrieving data from the database and generate the rdl report which will help us to analyze further and provide you a better solution. 
 
Regards, 
 
Naganathan K G 



NI Nicolas October 5, 2016 01:00 AM UTC

Hi, after checking the diagram is not directly related to a datasource, but only constructed from one, so I think I will go with another option which is to get an image stored in the server in bytes(), and will update the diagram image whenever necessary. I succeeded to pass the image to a rdl, report. Now I have a sub-question if you do not mind. Now I try to get a proper format on the diagram, and it seems that the right margin is too tight, and the bottom margin too big... I tried using orgchartLayout.Model.BottomMargin and orgchartLayout.Model.BottomMargin to set an appropriate value, it seems those values do not change anything, thank you in advance! - Nicolas


NG Naganathan Ganesh Babu Syncfusion Team October 5, 2016 12:28 PM UTC

Hi Nicolas, 
In diagram control, the Model’s Right and Bottom margins are updated automatically only when we enable the Model’s “SizeToContent” property. Otherwise it won’t get updated. So please enable the Model’s SizeToContent property while updating the Model’s Right and Bottom margin respectively and also refer to the below code example. 
Code example: 
[C#] 
//update the model size based on the content 
diagram1.Model.SizeToContent = true; 
Also if you want to update the left and top margin of the Model, then we suggest you to customize the DiagramController class and override the “GetBoundingRect” method to achieve your requirement. please refer to the below attached sample. 
Sample: 
Regards, 
Naganathan K G 
 
 



NI Nicolas October 5, 2016 09:19 PM UTC

Thanks a bunch, it's all good! - Nicolas


NG Naganathan Ganesh Babu Syncfusion Team October 6, 2016 04:01 AM UTC

Hi Nicolas, 
Thanks for the letting us know that the given solution works. Please reach us if you need any assistance. 
 
Regards, 
Naganathan K G 


Loader.
Live Chat Icon For mobile
Up arrow icon