none
Can we store a value in Office.js Add-in for a later use? RRS feed

  • Question

  • In our VSTO add-in for WORD we were using SQLite db to store a value for use in the Add-in that we could change in future. Is that something we can do in Office.js as well such as storing in XML or Jason etc?
    Wednesday, October 17, 2018 7:14 PM

Answers

  • Hi namwam,

    The Office Add-In using Office.js is a web application. 

    The following link is about a Web Application that uses SQLite:

    Web Applications with SQLite

    Hopefully it helps you.

    Best Regards,

    Lina


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    • Marked as answer by namwam Tuesday, November 6, 2018 9:09 PM
    Friday, October 19, 2018 6:28 AM
  • Hi namwam,

    Your add-in may need to persist data to maintain the continuity of certain operations or features across sessions of using your add-in. For example, your add-in may have custom settings or other values that it needs to save and reload the next time it's initialized, such as a user's preferred view or default location. To do that, you can:

    • Use members of the JavaScript API for Office that store data as either:

                  1). Name/value pairs in a property bag stored in a location that depends on add-in type.

                  2). Custom XML stored in the document.

    •  Use techniques provided by the underlying browser control: browser cookies, or HTML5 web storage (localStorage or sessionStorage).

    For more information, please refer the link as below:

    Persisting add-in state and settings

    Hopefully it helps you. Please feel free to ask any questions.

    Best Regards,

    Lina


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.



    • Edited by Lina-MSFT Thursday, October 18, 2018 2:05 AM
    • Marked as answer by namwam Tuesday, November 6, 2018 9:09 PM
    Thursday, October 18, 2018 1:59 AM

All replies

  • Hi namwam,

    Your add-in may need to persist data to maintain the continuity of certain operations or features across sessions of using your add-in. For example, your add-in may have custom settings or other values that it needs to save and reload the next time it's initialized, such as a user's preferred view or default location. To do that, you can:

    • Use members of the JavaScript API for Office that store data as either:

                  1). Name/value pairs in a property bag stored in a location that depends on add-in type.

                  2). Custom XML stored in the document.

    •  Use techniques provided by the underlying browser control: browser cookies, or HTML5 web storage (localStorage or sessionStorage).

    For more information, please refer the link as below:

    Persisting add-in state and settings

    Hopefully it helps you. Please feel free to ask any questions.

    Best Regards,

    Lina


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.



    • Edited by Lina-MSFT Thursday, October 18, 2018 2:05 AM
    • Marked as answer by namwam Tuesday, November 6, 2018 9:09 PM
    Thursday, October 18, 2018 1:59 AM
  • Hi Lina,

    How can we do it in a database? Currently I'm  using SQL db because we store some relevant items in that db as well.


    • Edited by namwam Thursday, October 18, 2018 11:24 PM
    Thursday, October 18, 2018 4:42 PM
  • Hi namwam,

    The Office Add-In using Office.js is a web application. 

    The following link is about a Web Application that uses SQLite:

    Web Applications with SQLite

    Hopefully it helps you.

    Best Regards,

    Lina


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    • Marked as answer by namwam Tuesday, November 6, 2018 9:09 PM
    Friday, October 19, 2018 6:28 AM
  • Hi namwam,

    Thanks for your asking. Please remember to mark the replies(Include your solution) as answers if they helped and please help us close the thread.

     

    Thank you for understanding. If you have any question, or update, please feel free to let us know.

     

    I wish you a happy life!

     

    Best Regards,

     

    Lina


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Monday, October 22, 2018 5:24 AM
  • Lina,

    I've posted another question here. I was wondering if you have any suggestions.

    Thank you,

    Nam

    Tuesday, November 6, 2018 9:12 PM