ola pessoal, gostaria de saber se tem como imprimir
um texto gravado em um campo Memo, tipo assim ?
set print to c:\loja\teste.txt
@ linha,col say ~primeira linha do campo memo~
@ linha,col say - segunda linha do campo memo
e assim sucessivamente
obrigado.
como imprimir texto de um campo memo
Moderador: Moderadores
-
alxsts
- Colaborador

- Mensagens: 3092
- Registrado em: 12 Ago 2008 15:50
- Localização: São Paulo-SP-Brasil
como imprimir texto de um campo memo
Olá!
Isso é fácil, através do uso das funções apropriadas disponíveis na linguagem (MemoRead(), MLCount(), MemoLine(). O exemplo abaixo foi extraído do manual do xHarbour mas serve para Clipper: Use a busca do fórum. Tem mais material disponível.
Isso é fácil, através do uso das funções apropriadas disponíveis na linguagem (MemoRead(), MLCount(), MemoLine(). O exemplo abaixo foi extraído do manual do xHarbour mas serve para Clipper:
Código: Selecionar todos
// The example demonstrates MemoLine() usage for extracting all lines
// of a text file. The difference of using line numbers versus using
// line offsets is outlined.
PROCEDURE Main( cFileName )
LOCAL nLineLen := 60
LOCAL nTabSize := 8
LOCAL lWrap := .T.
LOCAL i, imax, cText, cLine, nOffSet, nTextLen
LOCAL t1, t2, t3
IF Empty( cFileName ) .OR. .NOT. File( cFileName )
? "No file specified"
QUIT
ENDIF
cText := MemoRead( cFileName )
t1 := Seconds()
imax := MLCount( cText, nLineLen, nTabSize, lWrap )
FOR i:=1 TO imax
cLine := MemoLine( cText, nLineLen, i, nTabSize, lWrap )
NEXT
t2 := Seconds()
// This example shows the use of the <nOffSet> parameter.
// Note that the line number does not change, but the starting
// position in the text to begin extracting a line
nTextLen := Len( cText )
nOffSet := 1
i := 0
DO WHILE nOffSet <= nTextLen
cLine := MemoLine( cText, nLineLen, 1, nTabSize, lWrap,, @nOffSet )
i++
ENDDO
t3 := Seconds()
? "Using line number:", t2-t1, "secs (" + Ltrim(Str(imax)) + " lines)"
? "Using line offset:", t3-t2, "secs (" + Ltrim(Str(i)) + " lines)"
RETURN
[]´s
Alexandre Santos (AlxSts)
Alexandre Santos (AlxSts)
