Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Design question, for schedule
Message
De
18/02/2009 04:46:30
 
 
À
17/02/2009 20:17:23
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01382543
Message ID:
01382582
Vues:
40
This message has been marked as a message which has helped to the initial question of the thread.
>>Looking at the generated macro, I think I can assign a .ColorIndex from 1 to 40, representing 40 different colors. It doesn't look as if
>>I can assign an arbitrary rgb() value. (Is this correct?)

>>The question I had was mainly, how could or should this be designed? For a start, I think that if a certain class (i.e., the same
>>subject, for the same group of students) is held, for example, Monday and Thursday, I would like to color both cells with the same
>>color.

>>Should I assign random colors each time I run the Excel report? Perhaps trying to to repeat colors (assuming there are less than
>>40 classes)? Should I let the user store the color index in the table, together with the student classes? Or perhaps pre-assign a
>>random value in the table, but let the user change it? (I'll probably have to consult whether they want similar courses in the same
>>color, e.g. different courses for "Computer Networking, Semester 4" in the same color).

Before Excel 2007, you must use an indexed colour, I think there are actually 56 (Including White & Black). Excel 2007 has many more colours, but unfortunately I don't get to use them because many of my clients still have earlier versions.

The following code will create a spreadsheet showing you the 56 colours and their index value:
#define xlSolid                                           1
loExcel=CREATEOBJECT("Excel.Application")
loExcel.workbooks.Add()
loSheet1=loExcel.Workbooks(1).Worksheets.add
loSheet1.Select()
FOR lnk=1 TO 56
  WITH loSheet1
    lcRow=ALLTRIM(STR(lnk))
    .Range("A"+lcRow).Value=lnk
    .Range("B"+lcRow).Interior.ColorIndex = lnk
    .Range("B"+lcRow).Interior.PATTERN = xlSolid    
  ENDWITH
ENDFOR
loExcel.Visible=.T.
Personally I would create a lookup table of course titles and assign colours to those, you could then give them a way of manually amending. don't forget you have both text colour and fill colour.


Gary.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform