Get HostApp document

Add-in Express™ Support Service
That's what is more important than anything else

Get HostApp document
Get HostApp document 
Spiros Nikolopoulos


Guest


Hi,
I'm using Delphi XE2 and I created an add-in for office apps.
Supported Apps [ohaExcel,ohaWord,ohaPowerPoint].

I wan't to get the host Applications Active Ducument's filename from a taskpanel (TadxCustomTaskPanes) in AddinModule.

I can't find something in Delphi HOWTO or this Forum.

Thanks
Posted 26 Jan, 2012 11:33:10 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Spiros,

You can use the global variable that was created by the Add-in Express wizard in the code of your add-in module. Please see the sample below, in my case the global variable is named adxADX_CTPTest:

uses ComObj, ComServ, adxAddin;

{$R *.DFM}

{ TTaskPane1 }

procedure TTaskPane1.Button1Click(Sender: TObject);
begin
  if (adxADX_CTPTest.HostType = ohaExcel) then
    ShowMessage(adxADX_CTPTest.ExcelApp.ActiveWorkbook.FullName[adxLCID])
  else
  if (adxADX_CTPTest.HostType = ohaWord) then
    ShowMessage(adxADX_CTPTest.WordApp.ActiveDocument.FullName)
  else
  if (adxADX_CTPTest.HostType = ohaPowerPoint) then
    ShowMessage(adxADX_CTPTest.PowerPointApp.ActivePresentation.FullName);
end;
Posted 27 Jan, 2012 06:20:07 Top
Spiros Nikolopoulos


Guest


OK I've got it
Thanks
Posted 27 Jan, 2012 06:41:39 Top