Ver Mensaje Individual
  #1  
Antiguo 05-10-2017
jhonalone jhonalone is offline
Miembro
 
Registrado: sep 2007
Ubicación: Madrid
Posts: 547
Reputación: 17
jhonalone Va por buen camino
Imprimir FireMonkey en Windows

Hola a todos.
Yo y mis rarezas. Estoy intentando imprimir desde un programa Multidispositivo (FMX) en Windows.
Tengo estas Strings de prueba.
Código Delphi [-]
MemoFac.Lines.Clear; // Limpiar el memo

  TitNR := #13#10+'                        DATOS GLOBALES DE FACTURAS NORMALES                        '+#13#10+#13#10;
  TitND := #13#10+'                      RESUMEN DETALLADO DE FACTURAS NORMALES                       '+#13#10+#13#10;
  TitRR := #13#10+'                    DATOS GLOBALES DE FACTURAS RECTIFICATIVAS                      '+#13#10+#13#10;
  TitRD := #13#10+'                   RESUMEN DETALLADO DE FACTURAS RECTIFICATIVAS                    '+#13#10+#13#10;
  SepN  := '|-------|------------|------------------------------|----------|---------|---------|'+#13#10;
  SepR  := '|----------|---------------------------------------------------|---------|---------|'+#13#10;

  CabeD := ' Fechas | Nº Factura |            Nombre            |  N.I.F.  |   Base  |   IVA   |'+#13#10;
  CabeR := '|Canti Fact|          Intervalo temporal considerado           |Tot. Base|Tot. IVA |'+#13#10;

  IniD  := '|========|============|==============================|==========|=========|=========|'+#13#10;
  IniR  := '|==========|===================================================|=========|=========|'+#10;
  FinD  := '|========|============|==============================|==========|=========|=========|'+#13#10;
  FinR  := '|==========|===================================================|=========|=========|'+#13#10;

Me resulta más intuitivo el grupo #13#10 que sLineBreak . Mis disculpas.

Cuando las listo por pantalla en un TMemo. Salen perfectas.

El problema es cuando intento imprimir

Código Delphi [-]
procedure Imprimir;
  var
   MyRect : TRectF;
   V1 : integer;
   S : String;
  begin
  // MemoFac.Visible := True;
   with Printer.Canvas
do begin
   try Printer.BeginDoc;
        Font.Size   := Form1.Pica.Font.Size;
        Font.Family := Form1.Pica.Font.Family;
        Font.Style  := Form1.Pica.Font.Style;
        Fill.Color :=  Form1.Pica.TextSettings.FontColor;

   V1 := 155;


    MyRect.Create(IH(0),IV(v1),ih(Printer.PageWidth-150),iv(v1+75));
    FillText(MyRect, TitNR, False, 100,[TFillTextFlag.RightToLeft], TTextAlign.Leading, TTextAlign.Center);
    v1 := v1 + 75;

    MyRect.Create(IH(0),IV(v1),ih(Printer.PageWidth-150),iv(v1+75));
    FillText(MyRect, IniR, False, 100,[TFillTextFlag.RightToLeft], TTextAlign.Leading, TTextAlign.Center);
    v1 := v1 + 75;

    MyRect.Create(IH(0),IV(v1),ih(Printer.PageWidth-150),iv(v1+75));
    FillText(MyRect, CabeR, False, 100,[TFillTextFlag.RightToLeft], TTextAlign.Leading, TTextAlign.Center);
    v1 := v1 + 75;


    MyRect.Create(IH(0),IV(v1),ih(Printer.PageWidth-150),iv(v1+75));
    FillText(MyRect, FinR, False, 100,[TFillTextFlag.RightToLeft], TTextAlign.Leading, TTextAlign.Center);
    v1 := v1 + 75;

  Printer.EndDoc;
  except
   Printer.Abort;
   raise;
   end;
   end;
  end;

El resultado es este
Código Delphi [-]
// No salta línea como debería
'                        DATOS GLOBALES DE FACTURAS NORMALES                        '        
// Salta una línea no tres, pero sale correctamente
'|=========|=========|===================================================|==========|'      
// Invierte la string (como en espejo, la escribe de derecha a izquierda) salta una línea
 '|Canti Fact|          Intervalo temporal considerado           |Tot. Base|Tot. IVA |'     
// Sale correcta y salta una linea
'|=========|=========|===================================================|==========|'      
// Invierte la string (como en espejo, la escribe de derecha a izquierda) salta una línea

No entiendo la inversión de la escritura.

Por favor, si alguien me lo puede explicar os lo agradeceré infinito.

Saludos cordiales a todos.
__________________
"Pedid y se os dará; buscad y hallaréis ..." (Lc 11,9-10)
"...si no tengo caridad, nada soy..." (1 Cor 13,1-13)
Responder Con Cita