|
Professional Grid Usage
|
Date 12/Sep/2004
|
"A How To" on Loading an Excel Spreadsheet into your grid. Saving the Grid and re-Loading the Grid Format.
First Drop a Grid on the Form and Three Buttons.
I called the grid name "grid1" (for simplicity )
double click on button 1 [ Load the Excel file ] and put these lines.
Grid1.ImportFromExcelFile( 'BS.xls', 'sheet 1', True);
The file name I imported was called "BS.xls", I wanted "sheet 1" to be imported,
and the "True" bit ensures that the Layout ie: borders Merged cells were kept.
NOTE: Its does take time to Load - so be patient.
double click on button 2 [ Save the Layout Grid ] and put these lines.
Grid1.SaveToIniFile( 'bs1.ini' );
I called the saved file "bs1.ini"
double click on button 3 [ Load the Saved Layout file ] and put these lines.
Grid1.LoadFromIniFile( 'bs1.ini' );
again -- note: the saved file is called "bs1.ini"
// All the functions returns a Boolean True or False
// ImportFromExcelFile(const FileName: string; _
const SheetNameOrIndex: Variant; _
ImportCellBorders: Boolean = False): Boolean;
// SaveToIniFile(const FileName: string): Boolean;
// LoadFromIniFile(const FileName: string): Boolean;
There is an example of a progress BAR indicator on the web site:
The Grid has two onProgress Events ... Import Shown below.
procedure TForm1.Grid1ImportProgress(Sender: TProfGrid; FinishedSteps,
TotalSteps: Integer; var Stop: Boolean);
begin
Gauge1.MaxValue := TotalSteps;
Gauge1.Progress := FinishedSteps;
end;
It Works well! - As I say the Import can take Time:
This Grid is so easy to use ... It's a Pleasure!
|
|
|
Written by : Terry
|
|