Building RTD servers for Excel in Delphi
Add-in Express Home > Add-in Express for Office and Delphi VCL > Online Guide > Developing Excel RTD servers
Building Excel Real-Time Data servers
Using Add-in Express for Office and Delphi VCL you can create Real-Time Data servers for Microsoft Excel 2002 - 2021/365. You can download this Real-Time Data server project as well as many other examples on the How-To pages: Delphi for Outlook and Delphi for Excel.
Step 1. Creating a new Excel RTD Server project
Make sure that you have administrative permissions and run Delphi via the Run as Administrator command.
In the Delphi IDE, close all opened projects, select the File | New | Others item of the main menu, and run the Add-in Express Excel RTD Server wizard by clicking on the Add-in Express RTD server template in the "New Item" dialog.
In the RTD Server Project wizard window, enter the name of the project and the destination folder for it, and click Next.
The wizard generates a new RTD project and opens it in the Delphi IDE. The Real-Time Data server project includes the following items:
Step 2. RTD Server module
The RTD server module (MyRtdServer1_IMPL.pas and MyRtdServer1_IMPL.dfm) is the core part of the RTD Server project. The module is a container for TadxRTDTopic components.
The code of MyRtdServer1_IMPL.pas is as follows:
Step 3. RTD Server designer
The module designer allows setting RTD Server properties and adding components to the module. You set the properties of your RTD server module in the Object Inspector window.
The only Add-in Express component available for the module is the TadxRTDTopic component.
Step 4. Adding and handling a new topic
To add a new topic to your Excel RTD Server, in the Tool Palette, select the Add-in Express tab and drag-n-drop the TadxRTDTopic component onto the RTD Server Module.
Select the newly added component and, in the Object Inspector, specify the topic using the String## properties. Write your code to handle the RefreshData event of the RTD Topic component:
Write your code to handle the RefreshData event of the RTD Topic component:
Step 5. Running the RTD server in Excel
Choose the Register ActiveX Server item in the Run menu, restart Excel, and enter the RTD function to a cell.
Step 6. Debugging the RTD server
To debug your Real-Time Data server, just indicate Excel as the Start Program in the Project Options window.
To debug your add-in in Excel 64-bit, you have to register the add-in DLL using regsvr32; run it from an elevated 64-bit Command Prompt. In addition, you must explicitly specify to run the 64-bit Excel version in the dialog window shown above.
Step 7. Deploying your Real-Time data server
Make sure your setup project registers the RTD Server DLL (or EXE). Say, in Inno Setup projects you use the 'regserver' command.