Microsoft Excel reporting and 
 data analyzing with practically no coding. 
 .Net, ActiveX, and VCL versions. 
 www.AfalinaSoft.com  

Home    Products    Downloads    Registered users    Support    Prices    Order    Primary Subscription

 

MS Office COM Add-ins. Microsoft Excel reporting 
 and data analyzing


TaxpAddIn methods - Office Add-in Express Reference

<< Previous

Table of contents

Next >>


TaxpAddIn methods


AddCmdBar

Adds or finds the command bar.

protected
function AddCmdBar(const Name: string;
var NewControl: boolean;
Position: MsoBarPosition = msoBarFloating): IaxpCmdBar;

Adds or finds the command bar with the name (CommandBar.Name) specified by the Name parameter in the CommandBars collection of the host application. This method looks in the CommandBars collection for the command bar specified and creates it if there is no such a command bar. Returns a reference to the IaxpCmdBar interface.

Parameters:

  • Name - the name of the command bar (existing or newly created);
  • NewControl - returns TRUE if the command bar was created by the method; returns FALSE if the command bar existed before the method was called.
  • Position - the position of the command bar. Is specified by constants of the MsoBarPosition type.

Sample code:

var
ICmdBar: IaxpCmdBar;
isNew: boolean;
begin
ICmdBar := AddCmdBar('My Bar', isNew);
if isNew then
ICmdBar.Width ;= 200;
end;

Page Top

AddControl

Adds a control (CommandBarControl) to the specified command bar.

protected
function AddControl(const CmdBarName, Caption,
Tag, Hint: string; Type_: TaxpControlType;
var NewControl: boolean; Before: integer = -1;
Popup: IaxpPopup = nil): IaxpControl;

This method looks for a control with the specified Tag in the command bar called CmdBarName. If the control isn't found, the method creates the control and adds it to the command bar, initializing Caption, Tag, and Hint properties of the control according to the passed parameters. Returns a reference to the IaxpControl interface.

Parameters:

  • CmdBarName - the name of an existing command bar (CommandBar.Name), where the control is sought or created. If the command bar doesn't exist, an exception is fired.
  • Caption, Tag, Hint - the values of these parameters is used in order to initialize the corresponding properties of the control.
  • Type - The type of control to be added to the specified command bar. MS Office supports the following control types: Button, Combo Box, DropDown list, Edit box and Popup.
  • NewControl - returns TRUE if the control was created by the method; returns FALSE if the control existed before the method was called.
  • Before - a number that indicates the position of the new control on the command bar. The new control will be inserted before the control at this position. If this argument is omitted, the control is added at the end of the specified command bar.
  • Popup - by default the control is added to the command bar (CommandBar.Controls). If you specify the interface of a popup menu belonging to the command bar, the control will be added to the popup menu.

Sample code:

var
ICtrl: IaxpControl;
isNew: boolean;
begin
ICtrl := AddControl('My Bar', 'My control', 'MyControlTag',
'This is My Button', axpButton, isNew);
if isNew then
ICtrl.HelpFile := 'MyHelp.chm';
end;

Page Top

AddButton

Adds a button (CommandBarButton) to the specified command bar.

protected
function AddButton(const CmdBarName, Caption, Tag,
Hint, ImageIndex: string;
const Style: MsoButtonStyle; var NewControl: boolean;
Before: integer = -1; Popup: IaxpPopup = nil;
TransparentColor: TColor = clDefault): IaxpButton;

This method looks for a button with the specified Tag in the command bar called CmdBarName. If the button isn't found, the method creates the button and adds it to the command bar, initializing Caption, Tag, and Hint properties of the button according to the passed parameters. Returns a reference to the IaxpButton interface.

Parameters:

  • CmdBarName - the name of an existing command bar (CommandBar.Name), where the button is sought or created. If the command bar doesn't exist, an exception is fired.
  • Caption, Tag, Hint - the values of these parameters is used in order to initialize the corresponding properties of the button.
  • ResName - the name of the resource that contains the bitmap to be put on the button.
  • TransparentColor - determines which color of the bitmap (taken from the ResName resource) is to be transparent when the bitmap is drawn. This color is replaced with the clBtnFace color. By default the color of the bottom leftmost pixel is used as the value of TransparentColor.
  • Style - the style of the button.
  • NewControl - returns TRUE if the button was created by the method; returns FALSE if the button existed before the method was called.
  • Before - a number that indicates the position of the new button on the command bar. The new button will be inserted before the control at this position. If this argument is omitted, the button is added at the end of the specified command bar.
  • Popup - by default the button is added to the command bar (CommandBar.Controls). If you specify the interface of a popup menu belonging to the command bar, the button will be added to the popup menu.

Sample code:

var
IBtn: IaxpButton;
isNew: boolean;
begin
IBtn := AddButton('My Bar', 'My button', 'MyButtonTag',
'This is My Button', '', msoButtonIconAndCaption, isNew);
if isNew then
IBtn.Width := 60;
end;

Page Top

AddEdit

Adds an edit box to the specified command bar.

protected
function AddEdit(const CmdBarName, Caption,
Tag, Hint: string; Style: MsoComboStyle;
var NewControl: boolean; Before: integer = -1;
Popup: IaxpPopup = nil): IaxpEdit;

This method looks for an edit box with the specified Tag in the command bar called CmdBarName. If the edit box isn't found, the method creates the edit box and adds it to the command bar, initializing Caption, Tag, and Hint properties of the edit box according to the passed parameters. Returns a reference to the IaxpEdit interface.

Parameters:

  • CmdBarName - the name of an existing command bar (CommandBar.Name), where the edit box is sought or created. If the command bar doesn't exist, an exception is fired.
  • Caption, Tag, Hint - the values of these parameters is used in order to initialize the corresponding properties of the edit box.
  • Style - the style of the edit box.
  • NewControl - returns TRUE if the edit box was created by the method; returns FALSE if the edit box existed before the method was called.
  • Before - a number that indicates the position of the new edit box on the command bar. The new edit box will be inserted before the control at this position. If this argument is omitted, the edit box is added at the end of the specified command bar.
  • Popup - by default the edit box is added to the command bar (CommandBar.Controls). If you specify the interface of a popup menu belonging to the command bar, the edit box will be added to the popup menu.

Sample code:

var
IEdit: IaxpEdit;
isNew: boolean;
begin
IEdit := AddEdit('My Bar', 'My edit', 'MyEditBoxTag',
'This is My Edit', msoComboLabel, isNew);
if isNew then
IEdit.Text := 'New value';
end;

Page Top

AddComboBox

Adds a combo box to the specified command bar.

protected
function AddComboBox(const CmdBarName, Caption,
Tag, Hint: string; Style: MsoComboStyle;
DropDown: boolean; var NewControl: boolean;
Before: integer = -1;
Popup: IaxpPopup = nil): IaxpComboBox;

This method looks for a combo box with the specified Tag in the command bar called CmdBarName. If the combo box isn't found, the method creates the combo box and adds it to the command bar, initializing Caption, Tag, and Hint properties of the combo box according to the passed parameters. Returns a reference to the IaxpComboBox interface.

Parameters:

  • CmdBarName - the name of an existing command bar (CommandBar.Name), where the combo box is sought or created. If the command bar doesn't exist, an exception is fired.
  • Caption, Tag, Hint - the values of these parameters is used in order to initialize the corresponding properties of the combo box.
  • Style - the style of the combo box.
  • NewControl - returns TRUE if the combo box was created by the method; returns FALSE if the combo box existed before the method was called.
  • Before - a number that indicates the position of the new combo box on the command bar. The new combo box will be inserted before the control at this position. If this argument is omitted, the combo box is added at the end of the specified command bar.
  • DropDown - You remember that a combo box combines an edit box with a scrollable list. Set the DropDown parameter to FALSE if you want an edit box with a drop-down list, set it to TRUE to make the edit box read-only (forcing users to choose from the list).
  • Popup - by default the button is added to the command bar (CommandBar.Controls). If you specify the interface of a popup menu belonging to the command bar, the button will be added to the popup menu.

Sample code:

var
ICBox: IaxpComboBox;
isNew: boolean;
begin
ICBox := AddComboBox('My Bar', 'My combobox',
'MyComboBoxTag', 'This is My ComboBox',
msoComboNormal, True, isNew);
if isNew then begin
ICBox.Clear;
ICBox.AddItem('Item1', EmptyParam);
ICBox.AddItem('Item2', EmptyParam);
ICBox.AddItem('Item3', EmptyParam);
ICBox.AddItem('Item4', EmptyParam);
end;
end;

Page Top

AddPopup

Adds a popup control (CommandBarPopup) to the specified command bar.

protected
function AddPopup(const CmdBarName, Caption,
Tag, Hint: string; var NewControl: boolean;
Before: integer = -1;
Popup: IaxpPopup = nil): IaxpPopup;

This method looks for a pop-up control with the specified Tag in the command bar called CmdBarName. If the pop-up control isn't found, the method creates the pop-up control and adds it to the command bar, initializing Caption, Tag, and Hint properties of the pop-up control according to the passed parameters. Returns a reference to the IaxpPopup interface.

Parameters:

  • CmdBarName - the name of an existing command bar (CommandBar.Name), where the pop-up control is sought or created. If the command bar doesn't exist, an exception is fired.
  • Caption, Tag, Hint - the values of these parameters is used in order to initialize the corresponding properties of the pop-up control.
  • NewControl - returns TRUE if the pop-up control was created by the method; returns FALSE if the pop-up control existed before the method was called.
  • Before - a number that indicates the position of the new pop-up control on the command bar. The new pop-up control will be inserted before the control at this position. If this argument is omitted, the pop-up control is added at the end of the specified command bar.
  • Popup - by default the pop-up control is added to the command bar (CommandBar.Controls). If you specify the interface of a popup menu belonging to the command bar, the pop-up control will be added to the popup menu.

Sample code:

var
IPopup: IaxpCmdBarPopup;
isNew: boolean;
begin
IPopup := AddPopup('My Bar', 'My Popup', 'MyPopupTag',
'This is My Popup', IsNew);
if isNew then
IPopup.Width := 200;
end;

<< Previous

Table of contents

Next >>



Developed for

Delphi 5, 6, 7
Excluding Delphi Personal


[ Download it ]

[ Order now ]

Immediate shipment




ADX Toys™

Free sample
add-ins with a complete source code based on Add-in Express.

[  Read more  ]




We are Borland 
 technology partner


Copyright © 1999-2006
All right reserved.
Privacy Policy

Write to WebMaster

Page Top
Add-in Express - COM Add-ins, Smart Tags and RTDS in C#, VB, C++, J#, and Delphi