I wrote a library in C ++, according to the method used here (page 59) The library works on my computer (I have Excel 2013), but it does not work for another person (Excel 2016). How can you implement universally, so that for each Excel not to recompile?

Closed due to the fact that the essence of the question is not clear to the participants by gecube , user194374, cheops , αλεχολυτ , lexxl Aug 9 '16 at 9:03 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • No, the format itself may be different. - VladD
  • Moreover, your example is linked with a specific version of the MS Office libraries. - VladD
  • There is a way to get rid. This is the use of the functions LoadLibrary and GetProcAddress - this will allow you to use any version of the DLL supported by the programmer. Further. We have a problem with the DCOM import. The essence of the problem is that there are some description files, which allow writing calls to Excel directly in the body of the program (that is, so - Excel::_ApplicationPtr XL; ). It turns out that you need to either find these descriptions (TLB files) for all supported versions of Excel and inject them into the program. Or manually generate all the calls (this is still a trouble) ... brrrr. The code will look ugly - about - gecube

1 answer 1

The answer is no way.

I will explain.

There are basically two options for how to work with Excel files: - or use ready-made libraries; - either do everything yourself.

In the first case, you are limited by the capabilities of these libraries. If their developer has not put into it the functionality for working with Excel format XXX, then there is no way to get it. This type of library is full. I can not advise which is better, because need to specify the task.

It is even more fun when Office components are used to work with Excel (if it needs to be installed, however). This is valid, but then you need to determine the version of the installed package and work with it strictly according to its API. And it is often unnecessary to drag Excel to perform primitive work with Excel files.

If you do it yourself, then it all smells very complicated - the old Excel files were in binary format and also different incompatible versions. With newer simpler (which are xslx) - you can unzip the file, parse and ignore unfamiliar keywords. Of the benefits - you do not depend on what version of Excel is installed on the user.

But I’ll emphasize that if Excel comes out, say, 2020 and there again radically changes the format of data storage, then the program will still have to be rewritten.