Word Table Exception on Rows or Columns

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

Word Table Exception on Rows or Columns
 
Mark Stevens




Posts: 41
Joined: 2014-09-15
I'm using Delphi 10.0 with ADX and Word. I have a strange problem I can't get around and wondered if anyone else had come across it. I'm using the Word2000 type library.

The problem is I can't seem to use any of the Columns or Rows properties of a table. I just keep getting an 0x800A1018 exception which is a bad parameter. I can access Cells ok but adding row, deleting rows all give exceptions. Also, trying to declare a variable for "Row" gives a E2007 compile error. The 2 problems are probably related but I'm at a loss how to get around it. Example:


var
  tab: Table;
  trow: Row; // If I try to use this I get an E2007 error?
begin
  ...
  tab.Rows.Item(1).Delete; // Gives 0x800A1018 exception




Am I doing something wrong or is there some sort of conflict?

Thanks
Posted 01 Aug, 2017 08:30:41 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Mark,

Does the same occur if you turn *all* other COM add-ins off?

Also check if you have the username and initials specified in File | Options | General.


Andrei Smolin
Add-in Express Team Leader
Posted 01 Aug, 2017 10:15:03 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Does this occur on the active document?


Andrei Smolin
Add-in Express Team Leader
Posted 01 Aug, 2017 10:17:13 Top
Mark Stevens




Posts: 41
Joined: 2014-09-15
Hi Andrei

Thanks. All other COM add-ins are off. User name and initials are set.

I'm actually doing this via "WordApp.Selection.Range" but doing it via ActiveDocument gives the same error.

Is the E2007 compile error for "Row" relevant? Could there be some other library causing a conflict? I did try changing the order of libraries to no effect. When you click to go to the Declaration it finds it ok. The only way it will compile is if I change it to "Word2000.Row". However, this may be a red herring as if I move the code to a separate unit with just the uses required it's ok.
Posted 01 Aug, 2017 10:40:31 Top
Mark Stevens




Posts: 41
Joined: 2014-09-15
Hi Andrei

Sorry, my fault. It seems that because I had some vertically merged cells the "Rows" property doesn't work at all - even if I'm accessing the rows before the merged ones. Not what I expected but now I know!
Posted 01 Aug, 2017 11:33:56 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Mark,

Many thanks for posting your findings!


Andrei Smolin
Add-in Express Team Leader
Posted 02 Aug, 2017 03:03:53 Top