Store Delphi variables in Excel file

Add-in Express™ Support Service
That's what is more important than anything else

Store Delphi variables in Excel file
Does AddIn Express allow me to store local variables of the AddIn in the Excel file? 
Willem Van Deursen




Posts: 3
Joined: 2012-07-09
Hello all,

I am developing an Excel AddIn (D2010, Excel2013), and I would like to be able to store a few local Delphi variables (such as the ItemIndex of a combobox, and the values of a few strings) in the XLS file. Reopening the XLS file should then bring me in exactly the same state as I was before closing the XLS file ;-)

I designed a mechanism in which these values are stored in cells A1..A10 of the current sheet, but that is cumbersome if the user already used these cells. Is there any other mechanism to store the local Delphi variables in the spreadsheet-file?

Thanks for your help!
Willem
Posted 25 Mar, 2017 09:19:20 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Willem,

You can store such data in a custom document-level property. You create such a property using Workbook.CustomDocumentProperties; see https://msdn.microsoft.com/en-us/library/office/ff834990(v=office.15).aspx. Such a property is visible to the end user in the file's properties.

Another way would be to create a custom worksheet, set Worksheet.Visible=Excel.XlSheetVisibility.xlSheetVeryHidden, and use the sheet to store your data.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Mar, 2017 05:49:18 Top
Willem Van Deursen




Posts: 3
Joined: 2012-07-09
Hi Andrei,
thanks! The second way seems to be the easier way......

Regards from The Netherlands
Willem
Posted 28 Mar, 2017 03:59:43 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
You are welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Mar, 2017 04:04:07 Top