Pasos para Trabajar en Excel
Pasos para Trabajar en Excel
//Poner en uso la Unidad
ComObj
//Declarar la Variable
Excel : Variant;
//Crea la instancia (Abre Excel)
Excel := CreateOleObject('Excel.Application');
//Añade un Libro
Excel.WorkBooks.add;
//Pone Visible La Ventana
Excel.visible:=True;
//Introduce el Valor
Excel.Range['A1'].Value:='Hola';
//Guarda el Archivo
Excel.ActiveWorkBook.SaveAs('C:\LaPrueba.xls');
//Abrir un Archivo
Excel.WorkBooks.Open('C:\LaPrueba.xl');
//Salir
Excel.Quit
//Formatos
//Merge
Excel.Range['A1','D1'].Merge;
//Font
Excel.Range['A1'].Font.Size:=11;
Excel.Range['A1'].Font.Name := 'Verdana';
Excel.Range['A1'].Font.FontStyle := 'Bold';
Excel.Range['L14'].HorizontalAlignment := xlHAlignRight;
|