Ver Mensaje Individual
  #2  
Antiguo 20-05-2011
Avatar de newtron
[newtron] newtron is offline
Membrillo Premium
 
Registrado: abr 2007
Ubicación: Motril, Granada
Posts: 3.457
Reputación: 20
newtron Va camino a la fama
Hola.

Yo para exportar a excel lo hago de una forma ligeramente distinta y no tengo ese problema, mira a ver si te sirve este ejemplo:

Código Delphi [-]
              If TipoDocumento=0 then begin
                // Excel
                ExcelX := Trunc(ImpresoAnverso.SeccionPaneles.Panel[MiIndice].Elemento[f].X/15)+1;
                ExcelY := Trunc(ImpresoAnverso.SeccionPaneles.Panel[MiIndice].Elemento[f].Y/5)+1;

                Hoja.Cells.Item[LineaExcel+ExcelY,ExcelX].NumberFormat := '@';
                if ImpresoAnverso.SeccionPaneles.Panel[MiIndice].Elemento[f].TipoCampo=teReal then
                  Hoja.Cells.Item[LineaExcel+ExcelY,ExcelX].NumberFormat := '#.##0,00';
                if ImpresoAnverso.SeccionPaneles.Panel[MiIndice].Elemento[f].TipoCampo=teEntero then
                  Hoja.Cells.Item[LineaExcel+ExcelY,ExcelX].NumberFormat := '0';

                if sAux=StringOfChar('_',length(sAux)) then
                  Hoja.Cells.Item[LineaExcel+ExcelY,ExcelX].Font.underline:=True
                else
                  if ImpresoAnverso.SeccionPaneles.Panel[MiIndice].Elemento[f].TipoCampo=teReal then begin
                    Hoja.Cells.Item[LineaExcel+ExcelY,ExcelX]:=StrToCurr(StrTran(sAux,'.',''));
                  end else if ImpresoAnverso.SeccionPaneles.Panel[MiIndice].Elemento[f].TipoCampo=teFecha then begin
                    Hoja.Cells.Item[LineaExcel+ExcelY,ExcelX]:=FormatDateTime('dd/mm/yyyy',StrToDateTime(sAux));
                  end else begin
                    Hoja.Cells.Item[LineaExcel+ExcelY,ExcelX]:=sAux;
                  end;
                If fsBold in ImpresoAnverso.SeccionPaneles.Panel[MiIndice].Elemento[f].Fuente.Style then
                  Hoja.Cells.Item[LineaExcel+ExcelY,ExcelX].Font.Bold:=true;
                case ImpresoAnverso.SeccionPaneles.Panel[MiIndice].Elemento[f].Alineacion of
                  aCentrada : begin
                    Hoja.Cells.Item[LineaExcel+ExcelY,ExcelX].HorizontalAlignment := xlcenter;
                  end;
                  aDerecha: begin
                    Hoja.Cells.Item[LineaExcel+ExcelY,ExcelX].HorizontalAlignment := xlright;
                  end;
                end;
                if ExcelY>LineasE then LineasE:=ExcelY;
              end;

Saludos
Responder Con Cita