output to Excel File - xls

nate100

Member
I need to output some records to an excel file from Progress - character. I know how to do this to .csv as I can produce a comma delimited file but do not know how to output to an .xls file directly. Any help would be appreciated.
 
If the Excel document is going to get bigger then a few lines, then I would first make a csv file like you always do and then convert that to Excel and format it the way you like. You can do this by using somthing like:
Code:
    IF lp_savexls THEN h-ws:saveAs(REPLACE(cp_file,'csv','xls'),-4143,,,,,,). /* -4143 = xlWorkbookNormal */
    NO-RETURN-VALUE h-xl:VISIBLE = NO.
h-ws is the comhandle to the active worksheet....

This way of making Excel will proof to be much an dmuch faster then writing each cell in Excel directly.

Casper.
 
Can you create COM handles from a P4GL character client? I was assuming he was looking for one of those utilities (which are a dime a dozen in the Java/C# world) that let you create .XLS's without having access to the Excel runtime.
 
If all you are outputting is csv format files then simply name the output as xls.

ie.

OUTPUT TO "[dir]\yourfile.xls".

your looping here.

OUTPUT CLOSE.

other than that, or for more complicated Excel files you need to create a com handle and talk to Excel directly. I can provide an example if you wish.

Paul
 
Can you create COM handles from a P4GL character client? I was assuming he was looking for one of those utilities (which are a dime a dozen in the Java/C# world) that let you create .XLS's without having access to the Excel runtime.

The Excel com object would need to exist on the client machine. so if it is unix then i guess not.
 
If this is GUI, then you already know the basis (Outputting to CSV).
Output a stream to WhatEverFileName.xls
Let Windows do the hard work for you.
You are only interested in thde data extracted from the database.
Give that data to Windows and let that sort out the formatting.
Its that simple.
 
Back
Top