lcFindValue = "Visual Studio" oWord=createobject('Word.Application') with oWord .Documents.Open(GetFile('DOC')) loRange = .ActiveDocument.Content loRange.Select llRetVal = .Selection.Find.Execute(lcFindValue) .Visible = .t. .Activate if llRetVal loSelection = oWord.Selection && return an object reference else return .null. endif endwith ?loSelection.text3- Is easy and yet very complex. I can only give partial code from a live app for now :
#Define nTwipsPerInch 1440 lnPixelsPerInch = _GetPixelsPerInch(0) && 0 Horizontal * 1 Twip = 1/20 point, 567 twips 1 cm, 1 mm column gap lnSizeInPixels = txtwidth(lcSampleText, lcFont, lnFontSize) * ; fontmetric(6, lcFont, lnFontSize) *... loTable.Columns(ix).Width = ; ( lnSizeInPixels / lnPixelsPerInch * nTwipsPerInch + (567 * 0.1) ) / 20 Function _GetPixelsPerInch Lparameters lnDirection && 0 horizontal otherwise vertical If pcount() = 0 lnDirection = 0 Endif * Declarations done in main.prg *!* Declare INTEGER ReleaseDC IN Win32Api; *!* INTEGER nwnd, INTEGER hdc *!* Declare INTEGER GetDeviceCaps IN Win32API; *!* INTEGER hdc, INTEGER nIndex *!* Declare INTEGER GetWindowDC IN Win32API; *!* INTEGER hWnd #Define WU_LOGPIXELSX 88 #Define WU_LOGPIXELSY 90 lnDC = GetWindowDC(0) lnPixelsPerInch = GetDeviceCaps(lnDC, ; iif( lnDirection = 0, WU_LOGPIXELSX, WU_LOGPIXELSY ) ) lnDC = ReleaseDC(0, lnDC) Return lnPixelsPerInchFor printer check PageSetup object.