Ver Mensaje Individual
  #5  
Antiguo 10-01-2013
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Reputación: 23
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
Anusky,

Cita:
Empezado por Anusky
Problema:
Las columnas que son fechas las trae en juliano, en lugar de la fecha (dd/mm/aaaa) que yo veo en el fichero excell me trae un número.
Cita:
Empezado por Anusky
A ver si alguien me puede dar un poquillo de luz al problema, o por lo menos alguna idea de como afrontarlo.
Revisa esta Imagen:



La imagen anterior es un ejemplo de Automatización de Excel 2010 con Delphi 7.

Revisa este código:
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
   Excel, WrkS, WrkB : OLEVariant;
   Row, Col : Integer;
   Rows, Cols : Integer;

begin

   Excel := CreateOleObject('Excel.Application');
   Excel.Workbooks.Open(GetCurrentDir+'\TestData.xlsx');

   WrkS := Excel.Worksheets[1];
   Cols := WrkS.UsedRange.Columns.Count;
   Rows := WrkS.UsedRange.Rows.Count;

   for Row:= 1 to StringGrid1.RowCount do
         StringGrid1.Rows[Row].Clear;

   StringGrid1.FixedRows := 1;
   StringGrid1.FixedCols := 1;
   StringGrid1.RowCount := Rows + 1;
   StringGrid1.ColCount := Cols + 1;

   for Row:= 1 to StringGrid1.RowCount do
      for Col:= 1 to StringGrid1.ColCount  do
         StringGrid1.Cells[Col,Row]:= Excel.ActiveSheet.Cells[Row,Col].Value;

   Excel.Quit;    

end;
El código anterior lee por medio de la Automatización de Excel 2010 con Delphi 7 una hoja de cálculo sin alterar el contenido de la data obtenida y carga la misma en un control TStringGrid.

Revisa este link:
Cita:
Delphi 3 - Delphi and Microsoft Office: Automating Excel and Word
http://edn.embarcadero.com/article/10126
Espero sea útil

Nelson.

Última edición por nlsgarcia fecha: 10-01-2013 a las 22:51:14.
Responder Con Cita