[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Output both in PDF and Excel



We had exactly the same problem with users getting confused between .csv and 
.xls and 
format problems on machines with different regional settings for the list 
separator.
We now write directly to an excel spread sheet using a tab separator having 
adapted Ray 
Ontko's csv library.
A report now looks like this
#define XLS_FILE 2
#define OUT_MAX 500
do setup and other stuff here

input $format 'NORMAL for report, XLS for Excel'
if isblank($format)
   let $format = 'NORMAL'
end-if
if $format = 'XLS'
   let $out_name = 'C:\WINDOWS\TEMP\CFTS_Report.xls'
   open $out_name as {XLS_FILE} for-writing
   record={OUT_MAX}:vary
   status=#status
   if #status != 0
     let $alert = 'Cannot open xls file'
     show $alert 
     stop
   end-if
     !these are just titles for the report-write the data the same way
     do csv_set_string('Closed Investigation Files', $line)
     write {XLS_FILE} from $line
     do csv_set_string($vYear1, $line)
     write {XLS_FILE} from $line
     do csv_set_string('Box', $line)
     do csv_add_string('File Number', $line)
     do csv_add_string('Volume', $line)
     do csv_add_string('Filename', $line)
     do csv_add_string('Phase', $line)
     do csv_add_string('Closed Date', $line)
     write {XLS_FILE} from $line
end-if

and so on and then we include Ray's modified code here
begin-procedure csv_set_string( $s , :$t )
if isnull( $s )
   move '' to $t
else
   let $t = $s  
end-if
end-procedure

begin-procedure csv_add_string( $s , :$t ) 

if isnull( $s )
   let $t = $t || chr(9)
else
   let $t = $t || chr(9) || $s  
end-if
end-procedure

We run the report with the command line flags to write an spf file to the temp 
directory 
and the excel file to the same folder and then call excel from oracle forms to 
open the 
excel spreadsheet.

Kevin LaRoche
Oracle Forms Developer
Ottawa Ontario


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users