Duvida Formatar linha Excel

Discussão em 'Progress 4GL' iniciado por lm1979, Junho 30, 2016.

  1. lm1979

    lm1979 Membro Participativo

    Bom dia pessoal,
    Estou desenvolvendo um relatório que gera uma planilha Excel, agora estou na fase de formatação e preciso por bordas nas linhas e colunas, como eu posso fazer isso?

    Exemplo de como eu gero as linhas com os dados.
    /* Imprimindo o cabeçalho */
    ASSIGN
    chPlanilha:Range('J2'):VALUE = ped-venda.nr-pedcli
    chPlanilha:Range('J3'):VALUE = ped-venda.dt-emissao
    chPlanilha:Range('C12'):VALUE = emitente.nome-emit.
  2. Rkmann

    Rkmann Sem Pontuação

    Pode usar algumas destas funçoes ..

    FUNCTION fmtCelBorder RETURNS LOGICAL
    ( /* Parameters */ cel-destino as char, borders as integer,
    xlLineStyle as int, xlWeight as int):
    def var chBorders as com-handle.

    chBorders = Sheet:Range(cel-destino):Borders(borders).
    chBorders:LineStyle = xlLineStyle.
    chBorders:Weight = xlWeight.
    chBorders:ColorIndex = xlColorIndexAutomatic.
    If Valid-Handle(chBorders) then
    Release Object chBorders no-error.
    RETURN (NOT ERROR-STATUS:ERROR).

    END FUNCTION.

    FUNCTION fmtCelBorderAll RETURNS LOGICAL
    ( /* Parameters */ cel-destino as char, iTOTAL AS INT):
    def var chBorders as com-handle.
    DEFINE VARIABLE i AS INTEGER NO-UNDO.
    REPEAT i = 7 TO iTOTAL + 6:

    chBorders = Sheet:Range(cel-destino):Borders(i) NO-ERROR.
    chBorders:LineStyle = xlContinuous NO-ERROR.
    chBorders:Weight = xlThin NO-ERROR.
    chBorders:ColorIndex = xlColorIndexAutomatic NO-ERROR.


    END.

    If Valid-Handle(chBorders) then
    Release Object chBorders no-error.
    RETURN (NOT ERROR-STATUS:ERROR).

    END FUNCTION.

    FUNCTION fmtSelBorderAll RETURNS LOGICAL
    ( /* Parameters */ sel as COM-HANDLE, iTOTAL AS INT):
    def var chBorders as com-handle.
    DEFINE VARIABLE i AS INTEGER NO-UNDO.

    REPEAT i = 7 TO 12:

    chBorders = sel:Borders(i).
    chBorders:LineStyle = xlContinuous.
    chBorders:Weight = 2 /* xlThin */ .
    chBorders:ColorIndex = xlColorIndexAutomatic.

    END.

    If Valid-Handle(chBorders) then
    Release Object chBorders no-error.
    RETURN (NOT ERROR-STATUS:ERROR).

    END FUNCTION.
    lm1979 curtiu isso.
  3. bootstrapmaster

    bootstrapmaster Moderator Moderador Equipe de Suporte

    Código:
                if alinhamentoHorizontal <> ?   then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):horizontalAlignment   = alinhamentoHorizontal.
                if alinhamentoVertical   <> ?   then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):verticalAlignment     = alinhamentoVertical.
                if orientacao            <> ?   then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):Orientation           = orientacao.
                if formato               <> ''  then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):numberFormat          = formato.
                if corFundo              <> ?   then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):interior:Color        = getCor(corFundo).
                if bordaSuperior          = yes then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):borders(8):LineStyle  = 1.
                if bordaInferior          = yes then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):borders(9):LineStyle  = 1.
                if bordaEsquerda          = yes then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):borders(7):LineStyle  = 1.
                if bordaDireita           = yes then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):borders(10):LineStyle = 1.
                if fonte                 <> ?   then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):font:name             = fonte.
                if tamanhoFonte          <> ?   then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):font:size             = tamanhoFonte.
                if corFonte              <> ?   then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):font:Color            = getCor(corFonte).
                if negrito                = yes then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):font:bold             = negrito.
                if italico                = yes then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):font:italic           = italico.
                if sublinhado             = yes then planilha:ActiveWorkBook:ActiveSheet:cells(linhaAtual, colunaAtual):font:underline        = 2.
    
    lm1979 curtiu isso.
  4. lm1979

    lm1979 Membro Participativo

    Obrigado pessoal.

Compartilhe esta Página