Add-in Express™ for Microsoft® Office and Delphi® VCLAdd-in Express Home > Add-in Express for Office and VCL > Online Guide > Developing Excel RTD servers Building Excel Real-Time Data servers
Using Add-in Express for Office and VCL you can create Real-Time Data servers for Microsoft Excel 2002 (XP), 2003, 2007 and Excel 2010.
You can download this sample Real-Time Data server as well as many other examples from the
HowTo page.
Step 1. Creating a new RTD Server project
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 box.

In the RTD Server Project wizard window, enter the name of the project and the destination folder for it, and click Next.

Then specify the server type, the coclass name of your server, click Next and Finish.

The wizard generates a new project and opens it in Delphi IDE. The Real-Time Data server project includes the following items:
- The project source files (ProjectName.*)
- The type library files: binary (ProjectName.tlb) and Object Pascal unit (ProjectName_TLB.pas)
- The RTD server module (ProjectName_IMPL.pas and ProjectName_IMPL.dfm) discussed in the next step.
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:
unit MyRtdServer1_IMPL;
interface
uses
SysUtils, Classes, ComServ, MyRtdServer1_TLB, adxRTDServ;
type
TcoMyRtdServer1 = class(TadxRTDServer, IcoMyRtdServer1);
TRTDServerModule = class(TadxXLRTDServerModule)
private
protected
public
end;
implementation
{$R *.dfm}
initialization
TadxRTDFactory.Create(ComServer, TcoMyRtdServer1, CLASS_coMyRtdServer1, TRTDServerModule);
end.
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 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 RTD topic component and, in the Object Inspector window, identify the topic using the
String## properties.

Write your code to handle the RefreshData event of the RTD Topic component:
function TRTDServerModule.adxRTDTopic1RefreshData(Sender: TObject): OleVariant;
begin
Result := RandomRange(-100, 100);
end;
Step 5. Running the RTD server
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 2010 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 Excel 2010 64-bit in the dialog window shown above.
Step 7. Deploying the RTD server
Make sure your setup project registers the RTD Server DLL (or EXE). Say, in Inno Setup projects you
use the 'regserver' command.
Back to Add-in Express for Office and VCL homepage |