Using Open(stream) and then saving

Posted by: ssprankle on 8 September 2017, 2:39 pm EST

  • Posted 8 September 2017, 2:39 pm EST

    We have always used the fpspread.open(filename) to open and load our spread xml files. However, with our network edition, we want to open our xml files in a way that only one user at a time can open and use a spread file. The open(filename) doesn't work in this scenario, but the open(stream) does - it disallows another user to open the xml file while it is in use.


     My question is this - in conjunction with open(file), we've used fpspread.save(file) to save the updated xml file. Can we still use the fpspread.save(filename) to save to a file that was opened using fpspread.open(stream)? Or do we need need to change how we save and close the file? In addition, does using fpspread.open(stream) to open the file change any of the workings of the spread control?


    Thanks,


    Sally S 


     

  • Replied 8 September 2017, 2:39 pm EST

    Hello,

    Yes, you should be able to use any of the overload method for fpSpread1.Save( ). Once you have data in Spread, it should not create any difference how you are saving the file again whether using stream string. One thing to take care for is that you need to make sure that you mark all your custom classes as serializable  in order to make the custom functions or formulas work during deserialization/ serialization.

     

    Thanks,

     

  • Replied 8 September 2017, 2:39 pm EST

    Hello,


     


    Thank you for your response - it was helpful. However, I have a question regarding your comment about serialization. We do not explicitly use serialization/deserialization when opening and saving our spread xml files. Am I correct in thinking that Farpoint is doing this automatically when opening or saving the spread files? If that's the case, what classes in our project need to be marked as serializable - just the classes involved with opening and/or saving the spread files?


     


    Thanks,


    Sally

  • Replied 8 September 2017, 2:39 pm EST

    Hello Sally,

    You are right when you are just opening or saving XML file through spread you do not need to explicitly use serialization or deserialization. Serializable attribute should be added to any class created by you using Spread inbuilt classes in order to have them to support serialization. For example if you have used any custom celltype, custom functions, custom formulas, custom tags etc. you need to mark them as Serializable or implement ISerializeSupport interface.

     

    Thanks,

     

     

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels