FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Part of the text of a Word table cell
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Part of the text of a Word table cell
Posted: Thu Apr 03, 2025 10:43 AM

How can I get part of the text of a Word table cell ?

There is an object

oTb:Item(1):Rows:Item(1):Cells:Item(1)

However, if I try to cut out a piece of cell text,

oTb:Item(1):Rows:Item(1):Cells:Item(1):Range(1, 100):Text

I get an error (Word.Application:ACTIVEDOCUMENT:TABLES:ITEM:ROWS:ITEM:CELLS:ITEM/6 DISP_E_UNKNOWNNAME: RANGE)

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Part of the text of a Word table cell
Posted: Thu Apr 03, 2025 11:01 AM

LOCAL oCell, oRange

oCell := oTb:Item(1):Rows:Item(1):Cells:Item(1) // Get the first cell

oRange := oCell:Range // Get the range of the cell

oRange:Start := oRange:Start + 1 // Set start position

oRange:End := oRange:Start + 100 // Set end position (ensure it doesn't exceed)

? oRange:Text // Output the extracted text

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Part of the text of a Word table cell
Posted: Thu Apr 03, 2025 11:14 AM

It works, though !!! Thanks, Antonio !

Continue the discussion