Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Fun with spreadsheets

Hello Everybody. I am currently writing a database program for my soccer team. Right now I am using a StringGird as my spreadsheet and have a few questions. I am Relatively new to programming and am self taught so Please try to explain in detail. :)
# 1 Is there a way to save the string grid as an excell document
# 2 is there a way to import an excell spreadsheet into my string
grid
# 3 Is there a way to print the string grid?
# 4 what would be the most efficient method of sorting all
the "players" stored in the string grid first by one variable
then by another (ex: sort by last name and then by first
name)
My players are stored in an Array PlayerArray and the number of
Players in my spreadsheet is denoted by NumPlayers

NumPlayers : Cardinal;
PlayerArray:TPlayerArray;
TPlayerArray = array[1..10,000] of TPlayer
TPlayer = record
FirstName : String [25];
LastName : String [25];
MiddleInitial : String [1];
Street : String [80];
City : String [40];
State : String [25];
HS : String [40];
Club : String [40];
BirthYear : String [4];
BirthMonth : String [2];
BirthDay : String [2];
GradYear : String [4];
GK : Boolean;
Foreward : Boolean;
Defender : Boolean;
Midfielder : Boolean;
end;

Comments

  • zibadianzibadian Member Posts: 6,349
    : Hello Everybody. I am currently writing a database program for my soccer team. Right now I am using a StringGird as my spreadsheet and have a few questions. I am Relatively new to programming and am self taught so Please try to explain in detail. :)
    : # 1 Is there a way to save the string grid as an excell document
    : # 2 is there a way to import an excell spreadsheet into my string
    : grid
    : # 3 Is there a way to print the string grid?
    : # 4 what would be the most efficient method of sorting all
    : the "players" stored in the string grid first by one variable
    : then by another (ex: sort by last name and then by first
    : name)
    : My players are stored in an Array PlayerArray and the number of
    : Players in my spreadsheet is denoted by NumPlayers
    :
    : NumPlayers : Cardinal;
    : PlayerArray:TPlayerArray;
    : TPlayerArray = array[1..10,000] of TPlayer
    : TPlayer = record
    : FirstName : String [25];
    : LastName : String [25];
    : MiddleInitial : String [1];
    : Street : String [80];
    : City : String [40];
    : State : String [25];
    : HS : String [40];
    : Club : String [40];
    : BirthYear : String [4];
    : BirthMonth : String [2];
    : BirthDay : String [2];
    : GradYear : String [4];
    : GK : Boolean;
    : Foreward : Boolean;
    : Defender : Boolean;
    : Midfielder : Boolean;
    : end;
    :
    #1: Save the stringgrid as a tab-delimited text file
    #2: This is much harder: Import the Excel document interface into your program, then learn how to use it (it is poorly documented). Then you can access the individual cells of the document.
    #3: The TStringGrid has a Canvas property. You can use the TPrinter object to print that Canvas using th CopyRect() method.
    #4: Quicksort. If you change the array into a TList you have the Sort() method, which implements the quicksort based on a simple compare function, which you provide. This function only needs to implement an if-then statement comparing 2 TPlayer records with eachother.
Sign In or Register to comment.