How format excel table?

rainylsh

Member
dear all:
I remember somebody has discuss how format excel table some days ago.
But I can't find now.
I want use progess to set some tables' border's color, but it fail:
xls-app:range("A1").Borders.Color = RGB(0, 0, 0).
:confused:
and how format table's one side(eg. Bottom)'s color?
 

Scleameth

New Member
here's some code for colors and borders.
You can play around with the borders to get more results, I'm sure...

DEFINE VARIABLE chExcel AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chBook AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chSheet AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.

CREATE "Excel.Application" chExcel.
chExcel:Visible = TRUE.
chBook = chExcel:Workbooks:Add.
chSheet = chBook:Sheets(1).
chSheet:Name = "Color Test".

DO i = 1 TO 56:
chSheet:Range("A" + STRING(i)):Interior:ColorIndex = (i).
chSheet:Range("A" + STRING(i)):VALUE = STRING(i).
chSheet:Range("A" + STRING(i)):FONT :ColorIndex = IF i = 56 THEN i - 55 ELSE i + 1.
chSheet:Range("A" + STRING(i)):Font:Bold = TRUE.
chSheet:Range("A" + STRING(i)):HorizontalAlignment = -4108.
IF i > 1 AND i < 14 THEN
DO:
chSheet:range("C" + STRING(i)):borders(i - 1):ColorIndex = i + 6. /*just for some other colors*/
chSheet:range("C" + STRING(i)):borders(i - 1):linestyle = i - 1. /*start linestyle at 1 (solid)*/
END.
END.

RELEASE OBJECT chSheet.
RELEASE OBJECT chBook.
RELEASE OBJECT chExcel.

ASSIGN
chSheet = ?
chBook = ?
chExcel = ?.
 

Scleameth

New Member
Do you have excel handles with progress introductions?
Can you mail to me?

No sorry...
I normally record a macro in Excel while doing what my intention with Progress is. You can basically use the Excel code directly in Progress, replacing the VB format of, say Range("A1").Font.ColorIndex to Progress format - Range("A1"):Font:ColorIndex.
Progress can't interpret keywords like xlRight, but I just put in a MsgBox in the VB code to display the actual value. if you run "msgBox xlRight" in VB it displays "-4152".
 
Top