+ Reply to Thread
Results 1 to 7 of 7

Data storage in Excel

  1. #1
    Registered User
    Join Date
    08-16-2007
    Posts
    9

    Data storage in Excel

    Hi,
    I am doing a personal project of customizing excel 2007 using add-ins in visual studio 2005. I have a dataset storing some values and need to map the values to excel cells. Once the excel file is saved and closed, these mappings should be retained while reopening the file. Is it possible to achieve this kind of data storage which would be saved as a part of the excel file?

    Thanks,
    Dhruvan.

  2. #2
    Registered User
    Join Date
    08-11-2007
    Posts
    44
    I don't understand precisely your question.
    Do you need to keep the data or only their definition (mapping)?
    Explain your problem a little bit more precisely.

    Anyway, have you looked at how database queries can be stored on excel sheets and how these are refreshed and maintained, for example.

    Another example is the pivottable that can link to a database.
    The pivotcache structure can serialise the data within the excel file if the user choses to do so. I don't know which technique has been used in XL to implement that. I would like to know that !

    Personally, I have several applications that display only a small part of the results available (according to the user's wishes). These calculated results are not stored with the file. Therefore, if the user needs access to all the data generated by this (simulation) program, he will need to run the simulation (in excel) first (then the internal objects are re-initialized). Fortunately, this takes usually between 1 and 100 seconds and this is not really a big problem. This is why I abandonned the idea to serialize the (simulation) data with the excel file. In this way I can be sure I never have consistence problems between model and data. This illustrates that it might not be necessary to store the data when a refresh (recalculation) is not too expensive.
    Last edited by lalbatros; 08-16-2007 at 09:49 AM.

  3. #3
    Registered User
    Join Date
    08-16-2007
    Posts
    9
    Hi,
    To make it clearer, I have a dataset, it has two columns, one is a "header" column and the other is the "value" column. An example row would be,
    FirstName _____(value)
    Now, the value of firstname has to be entered in the excel sheet. I need to map this dataset cell to an excel cell in such a way that any change in that excel cell would be reflected back into the dataset cell.

    The problem does not end here. Once I get this done, I save the file and close it. When I open the file again, the mapping should still be available. The thing is, I am programming an add-in. The add-ins and all the objects within it (including the dataset) are re-initialized whenever the excel is started. So, how do I retain the mappings? Is their any way of storing such information along with the excel file itself which would be unique to that file.

    I hope it is clearer now

    Thanks,
    Dhruvan.

  4. #4
    Registered User
    Join Date
    08-11-2007
    Posts
    44
    Hi,

    Theoretically it is always possible to save (serialize) the state of an object (add-in) and to recover later the object in its state when saved.

    In addition, Excel offers you a natural storage for data: the excel sheets. Another natural storage in Excel would be a VBA module that would -somehow- recover the state of the object by some commands.

    However the implementation of such mechanism might lead you to a lot of work, and an additional obstacle is the absence of any infrastructure in excel for this kind of operation. (this is to my knowledge so up to Excel 2003, you could try to know more about the possibilities of Excel 2007.)

    The serialisation "infrastructure" is available in many languages (api). I know best Java in this respect, but C# or J# offers these possibilities without any doubt. Maybe VB.net offers you such a possibility too.

    It might also be possible to get this work done without a full "serialisation" api.

    However, I think that you might need a faster and pactical solution.

    Again, without more details it is nearly impossible to give you a sensible answer.

  5. #5
    Registered User
    Join Date
    08-16-2007
    Posts
    9

    Hi

    I have found a possible solution, it is data caching in excel. The msdn reference is http://msdn2.microsoft.com/en-us/library/aa722523.aspx

    But, here again I am getting the problem that I am not able to get it to work. I tried executing the code given in the link, but am getting a null-reference exception at the "me.IsCached("dataset1")" line.

    Let me know if you are able to get it to work or if there is any similar way to perform this functionality.

    Thanks,
    Dhruvan.

  6. #6
    Registered User
    Join Date
    08-11-2007
    Posts
    44
    I would be quite interrested, but I am having two problem now:

    - I am using XL2003
    - the reference you gave is apparently unrelated,
    its tile is "Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of "Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)"

    Could you check,
    thanks

  7. #7
    Registered User
    Join Date
    08-16-2007
    Posts
    9

    Sorry abt that

    My mistake.... The appropriate link is...
    http://msdn2.microsoft.com/en-us/lib...f3(VS.80).aspx

    And as for this caching, it is for 2003 and so it should very well hold for 2007 also....

    Thanks,
    Dhruvan.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1