Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
boa noite,
Não entendo muito de Delphi, estou pingando de sono... então já viram... precisa nem comentar!
Então, to mandando rodar o programa e da o seguinte erro [DCC Error] Unit1.pas(2943): E2016 Array type required, erro que se refere a esta linha WriteLn(PrintText, RichEdit1.Lines.Destroy[Line]);, o código do botão é esse abaixo! Lembrando que ja declarei o Printers no Uses.
procedure TForm_Banco_Dados.SpeedButton_Relatorio_ImprimirClick(
Sender: TObject);
var
Line: Integer;
//DECLARA A VARIÁVEL DO ARQUIVO DE IMPRESSÃO
PrintText: TextFile; AssignPrn(PrintText);
if (PrintDialog1.Execute) then
begin
//REDIRECIONA O ARQUIVO PARA A IMPRESSORA
//OBs: Printers DEVE SE DECLARADA EM USES
AssignPrn(PrintText);
//CRIA O ARQUIVO
Rewrite(PrintText);
//ADOTA A MESMA FONTE UTILIZADA NO RichEdit1
Printer.Canvas.Font := RichEdit1.Font;
for Line := 0 to (RichEdit1.Lines.Count - 1) do
begin
//ENVIA LINHA POR LINHA DO ARQUIVO PARA A IMPRESSORA
WriteLn(PrintText, RichEdit1.Lines.Destroy[Line]);
end;
//FECHA O ARQUVI DE IMPRESSÃO
CloseFile(PrintText);
end;
end;
Abraço
Carregando comentários...