[fpc-pascal] converting flexcel to fpc

Bisma Jayadi bisma at brawijaya.ac.id
Fri Aug 10 19:50:45 CEST 2007


> Thanks for the code. What example were you trying to compile? Didn't you 
> create a package file for the component? Just give me a startingpoint 

No, I didn't do that far (create a package). Just to make sure first the 
component will be compiled by FPC 2.0.4. Sorry, I forgot to give you the 
example. :-D

> please, it saves me from searching too long.

For first test, simply...

program TestFlexCel;

{$APPTYPE CONSOLE}

uses
   UFlexCelImport,
   XLSAdapter;

var
   FlexCelImport1: TFlexCelImport;
   XLSAdapter1: TXLSAdapter;
   i,j: Integer;
   s,v: string;

begin
   XLSAdapter1 := TXLSAdapter.Create(nil);
   FlexCelImport1 := TFlexCelImport.Create(nil);

   FlexCelImport1.Adapter := XLSAdapter1;
   FlexCelImport1.OpenFile('your_excel_file_here');

   for i := 1 to 5 do
   begin
     s := '';
     for j := 1 to 5 do
     begin
       v := FlexCelImport1.CellValue[i,j];
       s := s + v + ';';
     end;
     Writeln(s);
   end;

   FlexCelImport1.Free;
   XLSAdapter1.Free;
end.

The above example should print out 5 first columns and 5 first rows of the excel 
file. Tested using Delphi on winXP.

HTH.

-Bee-

has Bee.ography at:
http://beeography.wordpress.com




More information about the fpc-pascal mailing list