excell spreadsheet compatibility

excell spreadsheet compatibility

Portrait de jodama

I have access to Compaq Visual Fortran (version 6.6a) and wish to write a code (in Fortran) that will enable me to read input data directly from cells in an Excel spread sheet. How do I do this?

5 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de ArturGuzik

If you have access to the f90SQL software (f90SQL is a Fortran-90 interface to the ODBC-API implemented in Windows) thing should be easy. Look at example at http://www.canaimasoft.com/f90SQL/Examples/Example4.htm. If not you will have to, I think, use COM interfaces to access Excel and get data.

Portrait de Steve Lionel (Intel)

The freeware version of f90SQL is included with CVF 6.5 and 6.6, and can be downloaded from Canaima Software's web site.

Steve

Steve
Portrait de Community Admin

I think you'll have problems using SQL for direct access to Excel's cells. I think that your questions means that you want "read"/"write" data from/to 'i:j", so using SQL with Excel will be difficult. Use Automation and Compaq's tools for this purpose...

Vladimir V.Vasilchenko

Fortran Programmers Club

http://www.donpac.ru/usr/golub/fortran/

http://fortran-windows.tripod.com

Portrait de canaimasoft

For simple read/write operations, the ODBC way (using either the free or the Pro version of f90SQL) will work fine. Keep in mind, however, that ODBC sees your spreadsheet as another database table, so things like formatting, formulas, etc. are not available. Also the ODBC driver for excel has some limitation for writing (mainly it cannot delete spreadsheet rows). Still, using ODBC has advantages, it is fast and you don't need to have excel installed in the machine where your application is running.

The greatest level of flexibility and access can be achieved through the ActiveX/COM interface of excel (i.e. excel's automation interface). There are no limits here on what you can do with the spreadsheet. The main disadvantage is, however, that the machine where you Fortran application runs must also have excel installed, which may or may not be an issue in your case.

Our web site has examples of how to access excel spreadsheets using each of these paths. Check http://www.canaimasoft.com/f90sql/Examples/Examples.htm and http://www.canaimasoft.com/f90VB/Examples/Examples.htm (this last one uses another of our products called f90VB, which makes using ActiveX/COM from Fortran much easier than tapping into the direct Win-APIs).

Regards,

Marco Garcia
Canaima Software, Inc.
www.canaimasoft.com

Connectez-vous pour laisser un commentaire.