Conflict between reserved "Break" and Word 2010 "Break (IDispatch)"
Unable to use the Break reserved word if Word2010 is in the uses clause
|
Roger Middlebrook
Posts: 98
Joined: 2004-08-24
|
Word2010 unit defines a type Break so I can't use the Pascal reserved word Break. Can you suggest a good way round this? It may be obvious but I haven't found it and currently am getting round the issue by avoiding the Break reserved word when Word2010 is in the uses clause.it may be unhelpful, but it's all I've got... |
|
Posted 24 Sep, 2015 12:12:07
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 15594
Joined: 2006-05-11
|
Hello Roger,
You can refer to that type as Word2010.Break.
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 25 Sep, 2015 04:09:27
|
|
Top
|
|
Roger Middlebrook
Posts: 98
Joined: 2004-08-24
|
Thanks but I am actually getting the opposite problem. Perhaps I have misunderstood your answer. My problem is that I put the word "Break" (without used unit name) in my code and the compiler is picking up Word2010.Break instead. I wondered if there is a way of ensuring that the reserved word is using rather than Word2010.Break?it may be unhelpful, but it's all I've got... |
|
Posted 05 Oct, 2015 03:19:45
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 15594
Joined: 2006-05-11
|
Hello Roger,
Can you send me an example? What Delphi version do you use?
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 05 Oct, 2015 03:54:46
|
|
Top
|
|
Roger Middlebrook
Posts: 98
Joined: 2004-08-24
|
I know this code is nonsense but I quickly created a new ADX add-in to demonstrate the issue. We are using Delphi XE7.
unit WordBreakTest_IMPL;
interface
uses
SysUtils, ComObj, ComServ, ActiveX, Variants, Office2000, adxAddIn, WordBreakTest_TLB,
System.Classes;
type
TWordBreak = class(TadxAddin, IWordBreak)
end;
TAddInModule = class(TadxCOMAddInModule)
adxRibbonCommand1: TadxRibbonCommand;
procedure adxRibbonCommand1Action(Sender: TObject; const Pressed: Boolean;
var Cancel: Boolean);
private
protected
public
end;
implementation
uses
Word2010;
{$R *.dfm}
procedure TAddInModule.adxRibbonCommand1Action(Sender: TObject;
const Pressed: Boolean; var Cancel: Boolean);
var
i: Integer;
vDoc: Word2010._Document;
begin
vDoc := WordApp.ActiveDocument as Word2010._Document;
for i := 1 to 10 do
begin
if vDoc.Name = 'MyDocument' then Break;
end;
end;
initialization
TadxFactory.Create(ComServer, TWordBreak, CLASS_WordBreak, TAddInModule);
end. it may be unhelpful, but it's all I've got... |
|
Posted 05 Oct, 2015 04:30:20
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 15594
Joined: 2006-05-11
|
Thank you.
You can rename that type in the type library. If this doesn't work, you can delete that type from the type library and replace all references to IDispatch.
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 05 Oct, 2015 06:34:18
|
|
Top
|
|
Roger Middlebrook
Posts: 98
Joined: 2004-08-24
|
I was hoping it wouldn't come to that but I have now renamed it in the type library as you suggest.
Thank youit may be unhelpful, but it's all I've got... |
|
Posted 15 Oct, 2015 08:59:37
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 15594
Joined: 2006-05-11
|
Thank you for letting us know.
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 16 Oct, 2015 08:33:14
|
|
Top
|
|