Consultor Eletrônico



Kbase P6045: How to fill an embedded MS Excel Spreadsheet
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   24/01/2005
Status: Unverified

GOAL:

Fill an embedded MS Excel SpreadSheet

FIX:

DEFINE VARIABLE chSpreadSheet AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE iRow AS INTEGER INITIAL 2 NO-UNDO.

chSpreadSheet = chCtrlFrame:Spreadsheet.

/* Clear the SpreadSheet */
chSpreadSheet:Cells:Clear.


/* Fill the header */
chSpreadSheet:Cells(1, 1):VALUE = "Cust-num".
chSpreadSheet:Cells(1, 2):VALUE = "name".

/* Fill the WorkSheet */
FOR EACH customer NO-LOCK:
chSpreadSheet:Cells(iRow,1):VALUE = customer.cust-num.
chSpreadSheet:Cells(iRow,2):VALUE = customer.NAME.

/* Next Row */
iRow = iRow + 1.
END.

/* Release the COM HANDLE */
RELEASE OBJECT chSpreadSheet.

chCtrlFrame:Spreadsheet refers to a "Microsoft Office Spreadsheet 9.0" ActiveX control inserted into the window. See P6044, "How To Embed Excel in a Progress Window" for further information.