Ver Mensaje Individual
  #4  
Antiguo 15-06-2019
nincillo nincillo is offline
Miembro
 
Registrado: may 2017
Posts: 151
Reputación: 7
nincillo Va por buen camino
Cita:
Empezado por Casimiro Notevi Ver Mensaje
Mejor que pongas tu código.
He ido comentando partes del código del ejemplo y he conseguido "aislar" las partes que generan el problema. Con ellas comentadas, el fichero se genera correctamente.

A ver si así se os ocurre algo a alguno.

Un saludo
Código Delphi [-]
Procedure Tfrm_MainWindow.btn_StartClick( Sender: TObject );
Var
     I: Integer;
Begin
     With mxNativeExcel1 Do
     Begin
          NewFile;

          FileName := ChangeFileExt( ParamStr( 0 ), '' );
          AddFont( Label2.Font );
          AddFont( Label1.Font );

(* ------> Cualquiera de estas líneas provoca que el fichero resultante no sea reconocido por el excel
          SetHeader( 'Test Header' );
          SetFooter( '&N &P' );

          WriteLabel( 'This File was Create By Max''s Native Excel Component!' );
          ActiveFont := 1;
          WriteLabel( 2, 1, 'Please note that, this component is in Beta Test Phase' );
<--------- *)

          Row := 4;
          Column := 1;
          ActiveFont := 0;

          WriteNumber( 2147400000 );

          For I := 0 To 100 Do WriteInteger( I );

          Row := 7;
          Column := 1;
          For I := 0 To 100 Do
          Begin
               If I Mod 2 = 0 Then ActiveFont := 0 Else ActiveFont := 1;
               Shading := ActiveFont = 1;
               WriteInteger( Row + I, I * 2, I );
          End;

          Shading := FALSE;

          SetColumnWidth( 1, 53 );
          SetColumnWidth( 3, 10, 10 );

          Borders := [ ebTop, ebBottom, ebLeft, ebRight ];
          WriteBoolean( 6, 1, TRUE );
          WriteBoolErr( 7, 1, beNA );

          SetLeftMargin( 0.30 ); // ** This value has to be in inches **
          SetBottomMargin( 0.30 ); // ** This value has to be in inches **
          SetTopMargin( 0.30 ); // ** This value has to be in inches **
          SetRightMargin( 0.30 ); // ** This value has to be in inches **

          ProtectSheet( TRUE );

          CloseFile;

          SaveToFile;
     End;
End;

Última edición por Casimiro Notevi fecha: 15-06-2019 a las 13:04:36.
Responder Con Cita