WayneFrank
Member
Is there an example of a Progress program that does an export directly to Excel? Sort of like you can do for Word.
Thanks
Thanks
If you do a search in the Development forum, including the child forums, for posts with titles containing "Excel" you will find lots of useful information and sample code.
At this point we know virtually nothing of your requirement. It would be helpful to know some details, such as:
With more detailed requirements you may receive some more detailed assistance.
- What is your Progress version?
- What is your Excel version?
- Can you describe how you want your Excel spreadsheet to look or function?
- Can you describe what you have tried so far, if anything?
- Have you read the Progress manual OpenEdge Development: Programming Interfaces?
If not, read chapters 8 (Introduction to External Program Interfaces) and 14 (Using COM Objects in ABL).- Are you familiar with the Excel Object Model for your version of Excel?
/* Output the client's propath to an Excel workbook
* rcf - 04/15/2009
*/
define variable v-i as integer no-undo.
define variable chExcel as com-handle no-undo.
define variable chWorkbook as com-handle no-undo.
define variable chWorksheet as com-handle no-undo.
create "Excel.Application" chExcel no-error.
if error-status:error = true then
/* do error handling here: log error, exit, etc. */
do:
display "Microsoft Excel is not available on this platform." skip.
return.
end.
assign chWorkbook = chExcel:Workbooks:Add()
chWorksheet = chExcel:Sheets:Item(1).
chWorksheet:Range("a2"):Select.
repeat v-i = 1 to num-entries(propath):
if length(entry(v-i,propath)) > 0 then
chExcel:Selection:Value = entry(v-i,propath).
else
assign
chExcel:Selection:Value = "<blank line>"
chExcel:Selection:Font:ColorIndex = 3.
chExcel:Selection:Offset(1,0):Select.
end.
chWorksheet:Columns("a:a"):Select.
chExcel:Selection:Columns:AutoFit.
chWorksheet:Range("a2"):Select.
assign
chExcel:ActiveWindow:FreezePanes = true
chWorksheet:Range("a1"):Value = "Database: " +
DBNAME +
" (" +
string(v-i - 1) +
" entries)"
chWorksheet:Range("a1"):Font:Bold = true
chWorksheet:Range("a1"):Interior:ColorIndex = 15
chExcel:Visible = true.
release object chWorksheet.
release object chWorkbook.
release object chExcel.
CREATE "Excel.Application":U vchExcel.
vchExcel:VISIBLE = FALSE.
sprds_dir = "U:\PRG_DEVL\Scis\Forms\".
excel-spreadsheet-name = "accounts-receivable.xlsx".
ASSIGN vchExcel:VISIBLE = TRUE
vchWorkBook = vchExcel:WorkBooks:OPEN(sprds_dir + excel-spreadsheet-name)
vchWorkSheet = vchExcel:Sheets:ITEM(1).
vchWorkSheet:Range("C8") = 4321.