Buenas tardes.
Realicé los ajustes de lugar para poder aplicarlo con el componente que utilizo el cual es: "
TExcelApplication. ".
Adjunto el código que utilice para mostrar unos comentarios de una base de datos en el formato con que inicié mi pregunta.
Código Delphi
[-]
procedure TForm_Fondos_fijos_reponibles.Button1Click(Sender: TObject);
var
Start, Length: OleVariant;
Libro : _WORKBOOK;
Hoja : _WORKSHEET;
contar, i,colora:Integer;
Hojainicio:integer;
begin
ShowMessage('Espere un momento');
Libro := Excel.Workbooks.Add(Null, 0);
Hoja := Libro.Sheets[1] as _WORKSHEET;
i:=0;
i:=i+3;
Hoja.Cells.Item[i,1]:='Comentarios Para el Informe.';
with DataModule_financiero.query_fondos_fijos_reponibles do
begin
first;
contar:=0;
while not EOF Do
begin
i:=i+1;
contar:=contar+1;
Hoja.Cells.Item[i,1]:='Caso No. ' +inttostr(contar)+ ', ' + DBGrid1.Fields[8].AsString;
Hoja.Range['A'+ inttostr(i),'A'+ inttostr(i)].select;
Start := 1;
Length := 11;
Excel.ActiveCell.Characters[Start, Length].Font.FontStyle := 'Bold';
Next;
end;end;
Form_esperar.ProgressBar1.Position:= 0;
Form_esperar.hide;
ShowMessage('Exportado con Exito!');
Excel.Visible[0] := true;
end;
y en resumen, el código utilizado para realizar poner los 11 primeros caracteres en negrita es:
Código Delphi
[-]
Start := 1;
Length := 11;
Excel.ActiveCell.Characters[Start, Length].Font.FontStyle := 'Bold';
Ya que si utilizo el código
Código Delphi
[-]
Excel.ActiveCell.Characters(1, 9).Font.FontStyle := 'Negrita';
Me da error en los paréntesis.
Muchas Gracias Roman porque sin ti no lo hubiera podido hacer.
Te debo una.