Página 1 de 1
como imprimir texto de um campo memo
Enviado: 01 Mar 2013 16:44
por porter
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
Enviado: 01 Mar 2013 16:52
por alxsts
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:
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
Use a busca do fórum. Tem mais material disponível.
como imprimir texto de um campo memo
Enviado: 02 Mar 2013 09:06
por porter
obrigado amigo, deu certo, é isso que eu preciso.