Programs for Programmers

qtXLS - Read/Write Excel from Fortran

The qtXLS Library offers the programmer routines to access files in the Microsoft Excel format (.xls).

New: 32 and 64-bit versions for Intel Visual Fortran (see release notes).

With qtXLS routines you can

  • create files in the Excel data format
  • create tables (sheets) in these files
  • write data to tables (sheets)
  • write data to tables (sheets)
  • read data from tables (sheets)
  • enquire information about tables (sheets) and columns

 

To perform these functions the library provides you with the following routines:

Function group / qtXLS routine

Function

The example program

qtXLSDemoWriteTable.f90 (Fortran 90 source file)

qtXLSDemoWriteTable.cpp (C/C++ source file)

creates the following Excel sheet. The program demonstrates how the qtXLS routines are used.

The qtXLS software is provided as a dynamic-link-library (qtXLS.dll) together with bindings determined to use with your compiler (import libraries and other files necessary to compile and link).

 

Supported Compiler Systems (Bindings)

At present the following compilers are supported

  • Absoft ProFortran for Windows v10.0 (newer versions may be compatible - not tested)
  • Compaq Visual Fortran v6.6
  • Intel Visual Fortran (v10.x and newer versions)
  • Lahey/Fujitsu Fortran for Windows (LF95) v5.7
  • Microsoft Visual C++ v6 and v7 (2003; newer versions may be compatible - not tested)
  • Silverfrost / Salford FTN95 (for Win32) v5.0 and newer versions

These binding may also be suitable for newer versions of the compilers and possibly also for compatible compilers. If your compiler is not listed, but you would like to use qtXLS nevertheless, simply try out the binding anyway to which your compiler manufacturer claims to be compatible.

Download

You can download an evaluation copy of qtXLS (software and documentation in PDF format (2)). The software is limited in function (1). Size of the download file approx. 4 MB
(1) The evaluation copy allows to import and export of rows limited to 50 rows of a single table (sheet). Upon start of a program based on qtXLS there will be a message informing about this limitation.



Prices & Licensing

The evaluation copy can be changed into a version without limitation (1) by purchase of a qtXLS licence.
The licence allows you to use the qtXLS software for the development of programs, i.e. to create executable files (.exe). In addition, the licence covers the right to the passing on of the qtXLS.dll as well as the licence file (that you will receive on purchase of qtXLS). This means, there are no royalty or run-time fees to pay.

We deliver the licence by sending a licence file via eMail. The licence file contains the data specified by you (for example, name and address), a licence number and a licence key.

System Requirements

To be able to use the qtXLS software, the following is required::

  • PC with a Pentium processor, hard disk with at least 15 MB memory available, a minimum of 32 MB RAM.
  • One of the following operating systems: Microsoft Windows XP, Vista, 7, 8, 10 and compatible.

qtXLS is based on Microsoft Excel ODBC drivers. At installation of Excel these are usually installed. If these drivers are missing, they are either supplied by installation of Microsoft Excel or by installation of the

Microsoft Data Access Components (MDAC)

This is probably the cheaper alternative, because the MDAC can be downloaded for free from Microsoft's WebSite. If the link above doesn't help you to find them, try the search function in Microsoft's "Download Center”.

Of course, besides the above, a compiler system is needed (see the list of supported compilers above).

 

Release Notes regarding qtXLS (for Intel Visual Fortran)

========================================================

20. Aug. 2014:  The licensing has been changed. qtXLS now needs to be
                initialized by calling INTEGER FUNCTION 
                   QTXlsInitialize( cLicenceNumber, SUBROUTINE_qtSetLicence )
                For example: 
                    iRet = QTXlsInitialize('L0611-570739', qtSetLicence_qtXLS)
                Alternatively, instead of a licence number, 'evaluation' can be passed.
                For example: 
                  iRet = QTXlsInitialize('evaluation', qtSetLicence_qtXLS64)

17. March 2014: There was an error in qtXLSDoesTableNameExist. When it was called
                to check if an existing table exists, a second call returned a 
                faulty result and error 151. This has been fixed.

25. Jan. 2013: A new version for 64-bit systems has been created. This is currently
               available only for Intel Visual Fortran 12.1 and higher.
               + The new version also caused some general changes and extensions of
                 qtXLS. Two new routines are supplied for users of Intel Visual 
                 Fortran (other compilers will follow, if a sufficient number of
                 users ask for it):
                    SUBROUTINE qtXLSSetExcelDriverVersion( iExcelDriverVersion )
                    INTEGER(KINT2) FUNCTION qtXLSGetExcelDriverVersion( )
                 These functions are provided to allow the change of the Excel ODBC 
                 driver to be used (note: qtXLS uses ODBC functions to access Excel 
                 files). Now the following drivers are selectable:
                     No. OS      Version      DriverId  Excel ODBC Driver
                     50  32-Bit  Excel 5.0/97     22    Microsoft Excel Driver (*.xls)
                     80  32-Bit  Excel 97-2000   790    Microsoft Excel Driver (*.xls)
                     50  64-Bit  Excel 5.0/97     22    Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)
                     80  64-Bit  Excel 97-2000   790    Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)
                    120  64-Bit  Excel 12.0     1046    Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)
                 For 32-bit applications, no. 50 or no. 80 can be used (default is 
                 no. 50 in 32-bit qtXLS).
                 In 64-bit applications, also no. 120 is selectable (default is 
                 no. 80 in 64-bit qtXLS).
               + The 64-bit version binds different libraries: 
                    qtXLS64.dll  DLL to be used with 64-bit qtXLS applications
                    qtXLS64.lib  Import library to qtXLS64.dll.
               + Also, a new licence file is needed to create 64-bit qtXLS applications.
                 When purchasing qtXLS for 64-bit, Fortran programmers will receive a 
                 file whose format will be qtSetLicence_1459_######.f90 (# stands for 
                 a digit). This contains the qtXLS licence routine
                    SUBROUTINE qtSetLicence_QTXLS64( iError )
                 which has to be called prior any qtXLS function call.
                 To make qtXLS applications both compilable for 32-bit and 64-bit
                 Windows systems, Intel Visual Fortran users may code:
                    !DEC$ IF DEFINED(_WIN64)
                       CALL qtSetLicence_qtXLS64( iError )
                    !DEC$ ELSE
                       CALL qtSetLicence_qtXLS( iError )
                    !DEC$ END IF
               + qtXLSDeclarations
                 Due to the extension to 64-bit systems, a few additons and changes
                 were necessary. However these should not affect existing 32-bit 
                 qtXLS applications. In particular there is a special version of 
                    qtXLSDeclarations.f90
                 for Intel Visual Fortran users which serve both 32-bit and 64-bit 
                 qtXLS applications.
               + Change of the behaviour of qtXLSCreateEXCELFile
                 In earlier versions of qtXLS, an Excel file was created containing
                 3 sheets named Tabelle1, Tabelle2 and Tabelle3.
                 Now, the new qtXLS version for Intel Visual Fortran generates a new
                 Excel file without any sheets. If no sheet is created, there will also 
                 be no Excel file (i.e.: you have to call both qtXLSCreateEXCELFile
                 and qtXLSCreateTable to create a new Excel file).
               + The Intel Visual Fortran variant of 32-bit qtXLS requires now
                 Intel Visual Fortran v11.1 or higher.
               + Due to little interest, the qtXLS versions for Absoft Fortran, Compaq 
                 Visual Fortran, Salford/Silverfrost FTN95 and Lahey Fortran (LF95) 
                 will be supplied as they are, but there will be no further support. 
                 If there is some special demand, we would be willing to help, but 
                 would have to charge extra costs.
               + The current version of qtXLS for Intel Visual Fortran has been tested
                 on Windows XP (SE) and Windows 7 (Ultimate). We expect that it works
                 on any Windows version since XP (SE), but we cannot guarantee that it 
                 does for all Windows operating systems. Therefore, use the demo version
                 to check out yourself, if you are in doubt.

5. August 2010: In order to provide the source code of qtXLS, the licence checks are
                conditionally set to be able to turn them on and off. They are turned 
                off for the source code edition of qtXLS only.

19. April 2007: New version:
                + With most Fortran variants of qtXLS now a licence routine is 
                  supplied which replaces the licence file (format: L0611-######.lic).
                  The licence routine
                  SUBROUTINE qtSetLicence_QTXLS( iError )
                  is contained in a file named
                  qtSetLicence_0611_######.f90
                  It has to be called prior any other qtXLS function and authorizes
                  the usage of qtXLS.
                  Available for: Absoft ProFortran v10.0, Compaq Visual Fortran v6.6
                  Intel Visual Fortran v9.1, Lahey Fortran LF95 v5.7, 
                  Salford/Silverfrost FTN95 v5
                + qtXLS now also supports Absoft ProFortran v10.0.
                + The variants for Visual C++ and Compaq/Digital Visual Fortran v6.1 
                  have not been updated.

17. March 2006: The Visual C++ version now works with v6.0 and more recent versions 
                of Microsoft Visual C++ (tested with v7)
                The C example programs have been corrected.

                Default installation directory of Install_qtXLS.exe is now
                c:\Programme\QT software\qtXLS
                You can change this, if you want qtXLS to be installed in another location.

                The qtXLS binding for Compaq Visual Fortran v6.1 will not be supported
                any longer. Use the qtXLS.dll supplied in the directory
                ...\qtXLS\Bindings\CVF61
                This is the last qtXLS.dll which works with CVF 6.1.

16. Feb. 2006: A new variant (binding) has been published: for Intel Visual Fortran.
               Tested using IVF v8.1 and v9.0.

25. May 2004: If routine qtXLSDoesTableNameExist was called repeatedly, an error 
               occurred under special circumstances. Solved.

10. May 2004: Repeated initialisation of qtXLS causes an error in an internal
              routine qtInitForEXCEL (errorcode 70007). Solved.

7. May 2004: If a table was repeatedly read, qtXLSReadRows() returns a faulty
             number of read linces. Solved.

15. Apr. 2004: When writing values to different table text columns (type SQL_C_CHAR)
               an error occurred in qtXLSWriteRows(). Solved.

               Length of qt_I_MaxTableNameLEN changed:
               qt_I_MaxTableNameLEN = 20480    ! previously 256

               Problems with VC++ version (not solved)

               New version (not for CVF 6.6 or v6.1) is available as a patch.

1. Dec. 2003: FTN95 binding re-newed (because: "missing external qtXLSSetLicencePath").

20. Nov. 2003: Error 70007 when opening an Excel file repeatedly. Solved. 

6. Nov. 2003: Error when writing of REAL*4 (float) values. Solved.
              (qtXLSWriteRows() returned an error code -1)

              Problems with pure date structures (SQL_C_TYPE_DATE, SQL_C_DATE): 
              They cannot be used (see qtXLSWriteRows()).
              Problem not solved yet. 
              The same is probably true for SQL_C_TYPE_TIME and similar.
              Reason: The Excel-driver can work on date-time-structures only
              TYPE(qT_TIMESTAMP_STRUCT) bzw. qt_SQL_C_TIMESTAMP).
              Internally a mapping from pure date- and time-structures would be necessary.
              If desired, a solution could be provided, in January 2004.

28. Oct. 2003: 1. A new variante (binding) for Visual C++ v6.0 was published.
               2. A binding for Compaq Visual Fortran (CVF) 6.1 solves problems
                  due to different .mod files of CVF 6.6.

10. Sep. 2003: qtXLS published.