Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel Formatting ...
Message
 
À
09/10/2001 16:56:40
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00566207
Message ID:
00566413
Vues:
12
>I mean I create an object Excel.Application and put some values in there, but now I want to change the font of a column and maybe bold that column too. Anybody, please, can tell me how can I do that?

Hilmar Zonneveld had a great idea: record a macro and convert it to VFP. It's not that difficult, and there's a good MS Knowlege Base article on the topic.

However, sometimes seeing example code is nice, too. Here are some examples:

Increase column width by 2
oExcel.ActiveSheet.Columns[2].ColumnWidth =.ColumnWidth + 2
Change the alignment of a range of cells (other constants are available):
#DEFINE xlHAlignCenter -4108
oSheet.Range("A5:C5").HorizontalAlignment = xlHAlignCenter
When you record a macro, you'll see a ton of constants. For information on how to find the values of those constants so you can define them, see the very last question on this page: http://www.hentzenwerke.com/catalogavailability/autofoxfaq.htm

Change the font to bold, 14 pt, Times New Roman for a single cell:
WITH oSheet.Range("B2").Font
  .Name = "Times New Roman"
  .Size = 14
  .Bold = .T. 
ENDWITH
Hope this helps,

- della
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform