Office add-in in Delphi: add-in
custom ribbons, tabs, menu items, buttons
Add-in Express™
Create Office COM add-ins in DelphiAdd-in Express for Office and Delphi VCL is completely based on the Rapid Application Development (RAD) paradigm which makes the development of COM add-ins for Microsoft Office applications much quicker and easier. Office add-in developers will definitely appreciate the following features:
The sample below describes creating a COM add-in for Microsoft Excel and Microsoft Word. Another sample COM add-in for Office is available in the Developer's Guide. 1. Create a new COM add-in project with Add-in Express wizardIn the Delphi IDE, close all opened projects, select the "File|New|Other:" item on the main menu, and run the "Add-in Express COM Add-in" wizard on the "Add-in Express VCL" tab of the "New Item" dialog box. In the wizard windows, you enter the name and the destination folder for the add-in project, select either user or admin privileges for the add-in installation. The wizard then generates a new project and opens it in the Delphi IDE. 2. Customizing your Office add-inThe project includes the Add-in Module (MyAddin1_IMPL.pas on the screenshot above), which is the core part of Add-in Express based add-ins. The add-in module supports all Office versions from 2000 to 2021 32-bit and 64-bit and allows you to concentrate all code of the add-in in one place. Add-in module programmability:
3. Adding a custom tab to the Office RibbonAdd an instance of the Ribbon Tab component (TadxRibbonTab) to the module and populate the tab with controls using its visual designer. You can add any control to your custom ribbon tab. To add a built-in control onto a custom tab or to add a custom Ribbon group onto a built-in Ribbon tab, you need to know the ID of the built-in control or tab. The Ribbon Tab component creates and verifies the Office Ribbon XML markup automatically. Ribbon controls programmability:
4. Customizing Office Ribbon UIYou can use the following Ribbon components:
For instance, you can add a BackStage View component (TadxBackStageView) to the module and use its designer to customize the File tab. More about Ribbon components. 5. Custom panes in Office 2000 - 2021Add-in Express supports two pane types that work in different Office versions and provide different functionality:
Advanced task panes give you a well-considered object model and flexibility. Their context-sensitivity and visualization options cover a wide range of end-user requests. The technology is based on three entities:
Advanced task pane programmability:
More about Advanced Office task panes. 6. Adding an Office 2000 - 2003 command barTo add a custom toolbar to your add-in, drop a TadxCommandBar component onto the add-in module. Then specify the command bar properties and populate it with controls using the designer of the TadxCommandBar component. Available control types follow below:
Commandbar programmability:
Commandbar controls programmability:
7. Customizing the CommandBar UI of Office 2000 - 2003Add-in Express provides these components for customizing the toolbar subsystem of Office 2000, XP and 2003 applications:
For instance, you can customize an Office context menu in the following way: Find more about Command bar components. 9. Handling user actions and application eventsYou can use the Add-in Express components to intercept and cancel pressing a keyboard shortcut or keyboard combination, clicking a built-in command bar or Ribbon command as well as to handle events of the host application. Add-in Express also provides host-specific components to intercept application-level events in a handy, version-independent way. The application-level event components are provided for all supported Office 2021 - 2000 applications including Outlook, Excel, Word, PowerPoint, Visio, Project and others. 8. Running the add-inSave the project, compile it, close all the applications that you have selected as add-in host applications, and register the add-in via "Run|Register ActiveX Server". Run one of the selected host applications, find your Ribbon tab or toolbar and click on the button. The screenshot bellow shows a custom ribbon button in Excel:
|