How do you print file structure?

Posted on 1999-07-27
Medium Priority
Last Modified: 2010-04-04
How do you print file structure in
Delphi 3?  I notice that the desktop
database utility doesn't have a print
file structure feature.

Anybody have any idea?????
Question by:waipahu

Expert Comment

ID: 1391440
Hi waipahi,

I don't really understand what you want to do. I guess you think of the standard variable type "file" you can assign an external file. What's the meaning of "print" in this relationship? What result do you aim to?



Author Comment

ID: 1391441
I want to print the file structure for documentation.

Or If i can cut and past the layout and bring it
into MS word.


Author Comment

ID: 1391442
Need to print the file structure:
For instance: customer info layout

1. name     C 10
2. phone    C 7
3. address  C 35

etc etc..
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

LVL 10

Expert Comment

ID: 1391443
It seems you don't want to print a file's structure (as this wouldn't make any sense) but to print the content of a table, right?

If this is so then you have several opportunities. You could use QickReports or import the data to Excel.

Ciao, Mike

Author Comment

ID: 1391444
Yes I do want to print the file structure. You know the layout description of
each field and the data type. This is needed for documentation. I don't
want to print the data in the file. I want to print the file structure.

LVL 10

Expert Comment

ID: 1391445
Aha, now I understand what you want (and learned that my previous comment were wrong). It's a kind of extracting meta data from a database. Your description of extracting the structure of a file confused me as you really want to exctract the structure of a database/table, right?

Well, in this case I'd suggest to open the table in Delphi and use the Fields property. For each field you get its type and can convert it into a desctiptive string, along with its position in the table.

Does this help?

Ciao, Mike

Accepted Solution

kjteng earned 40 total points
ID: 1391446
The following code shows a way to save the dbstructure to
an abc.txt file. Tested on d1 and d3.
Modify for youself if necessary:

procedure TForm1.Button1Click(Sender: TObject);
var ii: Longint; s: string; sl: TStringlist;
  sl := TStringList.Create;
  with Table1.FieldDefs do
  for ii := 0 to Count -1 do begin
    s := IntToStr(Items[ii].FieldNo) +': ' + Items[ii].Name;
    case Items[ii].DataType of
      ftUnknown : s := s + ',' + 'Unknown';
      ftString  : s := s + ',' + 'String';
      ftSmallint: s := s + ',' + 'Smallint';
      ftInteger  : s := s + ',' + 'Integer';
      ftWord : s := s + ',' + 'Word';
      ftBoolean  : s := s + ',' + 'Boolean';
      ftFloat : s := s + ',' + 'Float';
      ftCurrency : s := s + ',' + 'Currency';
      ftBCD : s := s + ',' + 'BCD';
      ftDate : s := s + ',' + 'Date';
      ftTime : s := s + ',' + 'Time';
      ftDateTime : s := s + ',' + 'DateTime';
      ftBytes : s := s + ',' + 'Bytes';
      ftVarBytes : s := s + ',' + 'VarBytes';
      ftBlob : s := s + ',' + 'Blob';
      ftMemo : s := s + ',' + 'Memo';
      ftGraphic : s := s + ',' + 'Graphic';
      else s := s + ',' + 'Unknown';
    s := s + ',' + IntToStr(Items[ii].Size);
  end; {for}


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question