Impressao

Discussão em 'Progress 4GL' iniciado por thiagobhte, Setembro 1, 2010.

  1. thiagobhte

    thiagobhte Membro Participativo

    boa tarde, estou iniciando agora em progress e estou com uma dúvida:
    seguinte, tenho uma string e desejo imprimir ela num form. mas ela é um campo texto e é bastante grande. só que queria imprimir em 132 colunas, ai ela fica menor do que o tamanho da margem, dividindo em várias linhas, acredito que é por causa do enter que foi dado na linha ou por causa do tamanho do text-area.
    ex:
    está saindo:
    xxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxx

    desejado:
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxx

    verifiquei até o tamanho da string, mas na hora do display que estou em dúvida, faço um for que imprime caracter por caracter até atingir o limite e depois pula a página?


    obrigado.
  2. jalegria

    jalegria Membro Participativo

    da um replace nas quebras de linha por espaço [var = replace(var, chr(10), ' ')]
    depois imprime de 132 em 132...
  3. thiagobhte

    thiagobhte Membro Participativo

    obrigado. consegui com uma função que estava em meu código já.

    Código:
    procedure pi-print-editor:
    
        def input param c-editor    as char    no-undo.
        def input param i-len       as integer no-undo.
    
        def var i-linha  as integer no-undo.
        def var i-aux    as integer no-undo.
        def var c-aux    as char    no-undo.
        def var c-ret    as char    no-undo.
    
        for each tt-editor:
            delete tt-editor.
        end.
    
        assign c-ret = chr(255) + chr(255).
    
        do  while c-editor <> "":
            if  c-editor <> "" then do:
                assign i-aux = index(c-editor, chr(10)).
                if  i-aux > i-len or (i-aux = 0 and length(c-editor) > i-len) then
                    assign i-aux = r-index(c-editor, " ", i-len + 1).
                if  i-aux = 0 then
                    assign c-aux = substr(c-editor, 1, i-len)
                           c-editor = substr(c-editor, i-len + 1).
                else
                    assign c-aux = substr(c-editor, 1, i-aux - 1)
                           c-editor = substr(c-editor, i-aux + 1).
                if  i-len = 0 then
                    assign entry(1, c-ret, chr(255)) = c-aux.
                else do:
                    assign i-linha = i-linha + 1.
                    create tt-editor.
                    assign tt-editor.linha    = i-linha
                           tt-editor.conteudo = c-aux.
                end.
            end.
            if  i-len = 0 then
                return c-ret.
        end.
        return c-ret.
    end procedure.
    
    

Compartilhe esta Página