FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MS-Word get line number
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
MS-Word get line number
Posted: Fri Jun 17, 2016 08:21 PM
Is there a way to get a line number for a given text string?

I want to search for <DAT:SIG> and insert a picture where <DAT:SIG> is.

I can do the search with:
Code (fw): Select all Collapse
FUNCTION WordPicture( oSel, cSrc, cRpl, oWord )
    LOCAL oRng := oSel:Document:Content
     oRng:Find:MatchWildcards:= .t.
        IF AT( cSrc, oRng:Text ) = 0; RETURN .F.; ENDIF
       WHILE oRng:Find:Execute( cSrc )
         oRng:Text = ""
         oRng:Collapse( wdCollapseEnd )
       ENDDO
RETURN .T.


And can insert the picture with:
Code (fw): Select all Collapse
oWord:ActiveDocument:Shapes:AddPicture( cRpl, .T., .T., 1, 1, 150, 80)


I can go to a line with:
Code (fw): Select all Collapse
#define wdGoToAbsolute 1 
#define wdGoToLine 3 
oword:selection:goto(wdGoToLine, wdGoToAbsolute, nLineNumber)


I just need to know how to get the right value for nLineNumber based on the location of <DAT:SIG>.
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: MS-Word get line number
Posted: Sat Jun 18, 2016 12:31 AM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: MS-Word get line number
Posted: Tue Jun 21, 2016 07:39 PM

Thanks Cristobal.

I will give it a try.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion