# Excel AddIn

Qpid .net comes with Excel AddIns that are located in:

`<project-root>\qpid\dotnet\client-010\addins`

There are currently three projects:

ExcelAddIn

  An RTD excel Addin

ExcelAddInProducer

  A sample client to demonstrate the RTD AddIn

ExcelAddInMessageProcessor

  A sample message processor for the RTD AddIn

### Qpid RDT AddIn

#### Deploying the RTD AddIn

Excel provides a function called RTD (real-time data) that lets you specify a COM server via its ProgId here "Qpid" so that you can push qpid messages into Excel.

The provided RTD AddIn consumes messages from one queue and process them through a provided message processor.

For using the Qpid RTD follows those steps:

- Copy the configuration Excel.exe.config into `Drive\Program Files\Microsoft Office\Office12`.

- Edit `Excel.exe.xml` and set the targeted Qpid broker host, port number, username and password.

- Select the cell or cell range to contain the RTD information

- Enter the following formula `=rtd("Qpid",,"myQueue")`. Where MyQueue is the queue from which you wish to receive messages from.

Note: The Qpid RTD is a COM-AddIn that must be registered with Excel. This is done automatically when compiling the Addin with visual studio.

#### Defining a message processor

The default behavior of the RDT AddIn is to display the message payload. This could be altered by specifying your own message processor. A Message processor is a class that implements the API `ExcelAddIn.MessageProcessor`. For example, the provided processor in `client-010\addins\ExcelAddInMessageProcessor` displays the message body and the the header price when specified.

To use you own message processor follows those steps:

- Write your own message processor that extends ExcelAddIn.MessageProcessor

- Edit Excel.exe.config and uncomment the entries:

      <add key="ProcessorAssembly"
      value="<path>\qpid\dotnet\client-010\addins\ExcelAddInMessageProcessor\bin\Debug\ExcelAddInMessageProcessor.dll"/>

                  <add key="ProcessorClass"
                  value="ExcelAddInMessageProcessor.Processor"/>

  - ProcessorAssembly is the path on the Assembly that contains your processor class

  - ProcessorClass is your processor class name

- run excel and define a rtd function

Note: the provided ExcelAddInProducer can be used for testing the provided message processor. As messages are sent to queue1 the following rtd function should be used `=rtd("Qpid",,"queue1")`.