Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Example of the work with applications excel

The application solves data write into the Excel application.
 
- Example is placed in the folder: /Pm/Examples/AppExamples.
- This example is functional also as web application.
- Located in the application tree: /Examples/Database/Excel
 
The AppExcel folder contains Panel. The button script methods are located in the Methods page of the PmPanel object named 'ExcelReadFromPm', 'PmWriteToExcel' and 'ReadDataFromDB'. The particular xls files can be found in the application folder in Excel subfolder.

The three examples solve:

a) Opening the Excel application followed by launching this application macro (file: ExcelReadFromPmTemplate.xls).

In this example (ExcelReadFromPm method) the GetObject method opens a file ExcelReadFromPmTemplate.xls and then a macro named ReadFromXm contained in the Excel application is launched using the Application.Run method. The macro contains a script, that is read via XMLDOM Xml data offered by a webserver of this PROMOTIC application.

(The script is available after opening the file in the Excel environment by opening the Visual Basic language editor Alt+F11)

The disadvantage of this solution is the necessary decreasing of security level in the Excel environment allowing launching the macros.

b) b) Opening the Excel application and writing values into it (file: PmWriteToExcelTemplate.xls).

In this example (PmWriteToExcel method) the GetObject method is used for opening the PmWriteToExcelTemplate.xls file. This is followed by the script processing all the demanded operations.

The advantage of this solution is that the Excel file does not have to contain any macros.

The disadvantage is that when processing large data volumes into excel the writing is time consuming. This way the running of other parts of the PROMOTIC application can be limited

c) Opening the Excel application, reading the data from database (file: ReadDataFromDB.xls, DBData.dbf, DBData.csv).

In this example (ReadDataFromDB method) the Pm.ShellExecute method is used for opening the ReadDataFromDB.xls file (this application is independent on the PROMOTIC system).

This application solves reading the data from a database of the dbf type or from csv file.

(The script is available after opening the file in the Excel environment by opening the Visual Basic language editor Alt+F11)

Detailed example description Example of reading data from external databases in MsExcel

d) Reading the data into the PmTable object from a database (DataExcel.xls file) using the PmDatabase object.
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice