1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| DECLARE
-- directory for template document
c_template_dir VARCHAR2(300) := 'D:\RTM\AVIS_RETARD\TEMPLATE';
-- template document name
c_template_doc VARCHAR2(300) := 'LETTRE_RETARD.rtf';
-- directory for output
c_output_dir VARCHAR2(300) := 'D:\RTM\AVIS_RETARD\A_FAXER';
-- FichierIntrouvable EXCEPTION;
-- PRAGMA exception_init ( FichierIntrouvable, -302000 );-
outFileName VARCHAR2(200);
Load_File text_io.file_type;
Out_file text_io.file_type;
Str VARCHAR2(32767) := Null;
ind_debsec varchar2(20) := '[[';
ind_finsec varchar2(20) := ']]';
debsec number;
finsec number;
--counter NUMBER :=0;
BEGIN
-- source file
Load_File := text_io.fopen( c_template_dir ||'\'||c_template_doc,'r' );
outFileName := 'LOT_DATEJOUR'||'.rtf';
Out_file := text_io.fopen(c_output_dir||'\'||outFileName,'w' );
text_io.get_line( Load_File, Str );
debsec := instr(Str, ind_debsec, 1,1);
while (debsec=0)
loop
text_io.get_line( Load_File, Str );
debsec := instr(Str, ind_debsec, 1,1);
end loop;
text_io.get_line( Load_File, Str );
finsec := instr(Str, ind_finsec, 1,1);
while (finsec=0)
loop
text_io.get_line( Load_File, Str );
text_io.put_line( Out_file, Str );
finsec := instr(Str, ind_finsec, 1,1);
end loop;
/*WHILE ( TRUE )
LOOP
text_io.get_line( Load_File, Str );
--[finpage] c'est là que je veut inserer mon saut de page
Str := REPLACE( Str, '[FAX]', '\par \page');
text_io.put_line( Out_file, Str );
--counter := counter +1;
END LOOP; */
EXCEPTION WHEN NO_DATA_FOUND THEN
text_io.fclose( Load_File );
text_io.fclose( Out_file );
END; |
Partager