Olá galera, estou recebendo um erro de "Access violation" quando tento gerar pdf separados de boletos.
Tenho uma instancia do ACBrBoleto para o uso geral, e criei uma instancia separada do ACBrBoleto para dar loop na lista geral e ir imprimindo um por um.
Porém quando efetuo o "Clear" ao final do ACBrBoleto ele dispara o erro. Tem algo a ver as duas instancias ? mesmo separadas ?
Trecho do Código:
ACBrAux := TACBrBoleto.Create(nil);
try
try
ACBrAux.Cedente := Titulo.Cedente;
ACBrAux.Banco := Titulo.Banco;
ACBrAux.ACBrBoletoFC := BoletoFortesReport;
for i := 0 to Pred(Titulo.ListadeBoletos.Count) do
begin
ACBrAux.ListadeBoletos.Add(Titulo.ListadeBoletos.Objects[i]);
ACBrAux.ACBrBoletoFC.NomeArquivo := 'BO' + ACBrAux.ListadeBoletos.Objects[0].NossoNumero + '-' + BancoAux + '.PDF';
ACBrAux.GerarPDF;
RedirecionaArquivo(ACBrAux.ACBrBoletoFC.NomeArquivo, XTelaPrincipalF.Dir_Boletos +
'Boletos Emitidos\BO' +
ACBrAux.ListadeBoletos.Objects[0].NossoNumero + '-' +
BancoAux + '.PDF');
DeleteFile(ACBrAux.ACBrBoletoFC.NomeArquivo);
ACBrAux.ListadeBoletos.Clear;
end;
except on e: Exception do
begin
TMsgGen.MsgAviso('Erro: ' + e.Message);
Exit;
end;
end;
finally
dmCadastroF.QryConfiguracoes.Close;
end;
end;
except on e: Exception do
begin
TMsgGen.MsgAviso('Erro: ' + e.Message);
Exit;
end;
end;
finally
Titulo.ListadeBoletos.Clear;