Jump to content
Fivewin Brasil

Preview para TXT sem quebra de pagina.


Anderson.OL

Recommended Posts

Olá....

Tenho uma das variações da TDosPrn onde consigo criar um arquivo de texto sem quebra de paginas e sem limite de linhas....

Gostaria de saber se existe alguma classe/função de preview para um arquivo de texto deste tipo, pois a TXTPreview gera a famosa exceção: Erro BASE/1209 String overflow

Agradeço muito a dica de todos.

Abraços

Nesse mundo nada se cria, tudo se compila<<

//--Clipper 5.3b / FW 2.6 / Blinker 7.0 / WS 4.5 / RMAKE 1.4--//

//--

_Dom Quixote_

bRO Iris / Agility Knight / 9*/50

Editado por - Anderson.OL on 27/12/2005 09:06:04

Link to comment
Share on other sites

Olá....

Tenho uma das variações da TDosPrn onde consigo criar um arquivo de texto sem quebra de paginas e sem limite de linhas....

Gostaria de saber se existe alguma classe/função de preview para um arquivo de texto deste tipo, pois a TXTPreview gera a famosa exceção: Erro BASE/1209 String overflow

Agradeço muito a dica de todos.

Abraços

Nesse mundo nada se cria, tudo se compila<<

//--Clipper 5.3b / FW 2.6 / Blinker 7.0 / WS 4.5 / RMAKE 1.4--//

//--

_Dom Quixote_

bRO Iris / Agility Knight / 9*/50

Editado por - Anderson.OL on 27/12/2005 09:06:04

Link to comment
Share on other sites

Olá....

Tenho uma das variações da TDosPrn onde consigo criar um arquivo de texto sem quebra de paginas e sem limite de linhas....

Gostaria de saber se existe alguma classe/função de preview para um arquivo de texto deste tipo, pois a TXTPreview gera a famosa exceção: Erro BASE/1209 String overflow

Agradeço muito a dica de todos.

Abraços

Nesse mundo nada se cria, tudo se compila<<

//--Clipper 5.3b / FW 2.6 / Blinker 7.0 / WS 4.5 / RMAKE 1.4--//

//--

_Dom Quixote_

bRO Iris / Agility Knight / 9*/50

Editado por - Anderson.OL on 27/12/2005 09:06:04

Link to comment
Share on other sites

  • 1 year later...

Olá,

Anderson.OL, você teria essa TDosPrn para me enviar ?

Estou com o problema abaixo:

Erro BASE/1209 String overflow

Agradeço desde já.

zima@uol.com.br

Marcelo Zima

Santo André/SP

zima@uol.com.br

FW 2.3,Clipper 5.3,Workshop,Blinker 7.0

Link to comment
Share on other sites

olá,

segue código:


#include "fivewin.ch"

#include "fileio.ch"

#translate nTrim() => AllTrim(Str(,10,0))

#define PF_BUFLEN 2048

//----------------------------------------------------------------------------//

CLASS TDosPrn

DATA LastError

DATA cPort, cCompress, cNormal, cFormFeed, cBuffer

DATA hDC, nRow, nCol, nLeftMargin, nTopMargin

DATA lAnsiToOem,lCompress

DATA lZeraBuffer

DATA oWnd, oPagina

DATA nPage AS NUMERIC

METHOD New(cPort) CONSTRUCTOR

METHOD End()

METHOD StartPage() INLINE ::ShowProc()

METHOD EndPage()

METHOD Command(cStr1, cStr2, cStr3, cStr4, cStr5)

METHOD SetCoors(nRow, nCol)

METHOD NewLine() INLINE (::cBuffer += CRLF ,;

::nRow++ ,;

::nCol := 0 )

METHOD Write(cText, lAToO) ;

INLINE (iif(lAtoO == NIL, lAtoO := .T.,),;

::cBuffer += iif(lAtoO, AnsitoOem(cText), cText) ,;

::nCol += len(cText) )

METHOD Say(nRow, nCol, cText, lAToO)

METHOD SayCmp(nRow, nCol, cText)

METHOD CharSay(nRow,nCol,cText) INLINE (IIf(::lCompress,;

::SayCmp(nRow,nCol,cText),;

::Say(nRow,nCol,cText)))

METHOD ZeraBuffer()

METHOD PrintFile(cFile)

METHOD ShowProc()

ENDCLASS

//----------------------------------------------------------------------------//

METHOD New(cPort, lFile, lCompress) CLASS TDosPrn

DEFAULT cPort := "LPT1" ,;

lFile := .T. ,;

lCompress := .f.

cPort := Upper(cPort)

::cCompress := "15"

::cNormal := "18"

::cFormFeed := "12"

::cBuffer := ""

::nLeftMargin := 0

::nTopMargin := 0

::nRow := 0

::nCol := 0

::lAnsiToOem := .T.

::cPort := cPort

::hDC := fCreate(::cPort)

::LastError := 0

::lZeraBuffer:=.F.

IF ::hDC < 0

::LastError := fError()

ENDIF

::nPage := 1

::ShowProc()

RETURN Self

//----------------------------------------------------------------------------//

METHOD End() CLASS TDosPrn

IF !empty(::nRow+::nCol)

::EndPage()

ENDIF

::LastError := 0

IF !fClose(::hDC)

::LastError := fError()

ENDIF

CursorArrow()

if ::oWnd != Nil

::oWnd:End()

endif

RETURN NIL

//----------------------------------------------------------------------------//

METHOD EndPage() CLASS TDosPrn

LOCAL nFor, nLen, nSec

LOCAL lError

If !::lZeraBuffer

::Command(::cFormFeed)

End

::LastError := 0

IF fWrite(::hDC, ::cBuffer) < len(::cBuffer)

::LastError := fError()

ENDIF

::cBuffer := ""

::nRow := 0

::nCol := 0

RETURN NIL

//----------------------------------------------------------------------------//

METHOD Command(cStr1, cStr2, cStr3, cStr4, cStr5) CLASS TDosPrn

LOCAL cCommand, cToken, cString

LOCAL nToken

cString := cStr1

IF cStr2 != NIL

cString += ","+cStr2

ENDIF

IF cStr3 != NIL

cString += ","+cStr3

ENDIF

IF cStr4 != NIL

cString += ","+cStr4

ENDIF

IF cStr5 != NIL

cString += ","+cStr5

ENDIF

cCommand := ""

nToken := 1

DO WHILE !Empty(cToken := StrToken(cString, nToken++, ","))

cCommand += Chr(Val(cToken))

ENDDO

::cBuffer += cCommand

RETURN NIL

//----------------------------------------------------------------------------//

METHOD SetCoors(nRow, nCol) CLASS TDosPrn

nRow += ::nTopMargin

nCol += ::nLeftMargin

IF ::nRow > nRow

::EndPage()

::nPage++

::StartPage()

ENDIF

IF nRow == ::nRow .AND. nCol < ::nCol

::EndPage()

::nPage++

::StartPage()

ENDIF

DO WHILE ::nRow < nRow

::NewLine()

ENDDO

IF nCol > ::nCol

::Write(Space(nCol-::nCol))

ENDIF

If Len(::cBuffer)>=7928

::ZeraBuffer()

End

RETURN NIL

//----------------------------------------------------------------------------//

METHOD Say(nRow, nCol, cText, lAToO) CLASS TDosPrn

DEFAULT lAToO := ::lAnsiToOem

IF VALTYPE( cText ) = "D"

cText := DTOC( cText )

ENDIF

IF VALTYPE( cText ) = "N"

cText := STR( cText )

ENDIF

::SetCoors(nRow, nCol)

::Write(cText, lAToO)

RETURN NIL

//----------------------------------------------------------------------------//

METHOD SayCmp(nRow, nCol, cText, lAToO) CLASS TDosPrn

DEFAULT lAToO := ::lAnsiToOem

::Command(::cCompress)

::SetCoors(nRow, nCol)

::cBuffer += iif(lAToO, AnsitoOem(cText), cText)

::nCol += Int(len(cText))

::Command(::cNormal)

RETURN NIL

//----------------------------------------------------------------------------//

METHOD ZeraBuffer() CLASS TDosPrn

::LastError := 0

If ::lZeraBuffer

IF fWrite(::hDC, ::cBuffer) < len(::cBuffer)

::LastError := fError()

ENDIF

::cBuffer := ""

Endif

RETURN NIL

//----------------------------------------------------------------------------//

FUNCTION WorkSheet(cPort)

LOCAL oPrn

LOCAL cLine

LOCAL nFor

cLine := ""

FOR nFor := 0 TO 7

cLine += Str(nFor,1)+Replicate(".",9)

NEXT

cLine := Substr(cLine,3)

oPrn := TDosPrn():New(cPort)

oPrn:StartPage()

FOR nFor := 0 TO 65

oPrn:Say(nFor,0,StrZero(nFor,2)+cLine)

NEXT

oPrn:EndPage()

oPrn:End()

RETURN NIL

//----------------------------------------------------------------------------//

METHOD PrintFile(cFile) CLASS TDosPrn

LOCAL hFile

LOCAL nRead

LOCAL cBuffer

hFile := FOpen(cFile, FO_READ)

IF hFile < 0

RETURN .F.

ENDIF

cBuffer := Space(PF_BUFLEN)

DO

nRead := fRead(hFile, @cBuffer, PF_BUFLEN)

IF fWrite(::hDC, Left(cBuffer, nRead)) < nRead

::LastError := fError()

fClose(hFile)

RETURN .F.

ENDIF

UNTIL nRead == PF_BUFLEN

fClose(hFile)

RETURN .T.

//----------------------------------------------------------------------------//

METHOD ShowProc() CLASS TDosPrn

RETURN NIL

//----------------------------------------------------------------------------//

id=code>id=code>

para resolver este erro, utilize oPrinter:lZeraBuffer := .T.

um abraço

Yury Marcelino Al

vimansca@vimansca.com.br

yury030575@yahoo.com.br

skype: yury.marcelino.al

Leme / SP

FW 2.6 / [x]Harbour 99.50 / WS / xDev 0.65

Link to comment
Share on other sites

Hello Anderson...

Se estiveres usando um WHILE... ENDDO COLOQUE UM SYSREFRESH() NO WHILE, POIS ESTA ESTOURANDO A STRING.

OU VEJA SE NAO TENS NESTE MODULO, UM ARQUIVO.CH DESNECESSÃRIO. RETIRE-O.

João Santos - São Paulo.

kmt_karinha@pop.com.br

kapiaba@brfree.com.br

Skype: fw_kapiaba

FWH 2.7 - xHARBOUR 0.99.61 - WorkShop.Exe

Link to comment
Share on other sites

gente, acho q o Anderson não tá querendo nada...

olhem a data dos posts...

ele queria isso em dezembro de 2005...

quem tá querendo é o Marcelo Zima...

Yury Marcelino Al

vimansca@vimansca.com.br

yury030575@yahoo.com.br

skype: yury.marcelino.al

Leme / SP

FW 2.6 / [x]Harbour 99.50 / WS / xDev 0.65

Link to comment
Share on other sites

citação:

gente, acho q o Anderson não tá querendo nada...

olhem a data dos posts...

ele queria isso em dezembro de 2005...

quem tá querendo é o Marcelo Zima...

Yury Marcelino Al

vimansca@vimansca.com.br

yury030575@yahoo.com.br

skype: yury.marcelino.al

Leme / SP

FW 2.6 / [x]Harbour 99.50 / WS / xDev 0.65


id=quote>id=quote>

hehe, realmente.

Mas a resposta é a mesma.

Um abraço

assinatpaulo.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...