home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 April A / Pcwk4a98.iso / PROGRAM / DELPHI16 / EXCEL / EXCEL.TXT next >
Text File  |  1997-11-19  |  8KB  |  247 lines

  1. ====================
  2. TExcel component 3.2
  3. ====================
  4. TExcel is a component to produce output tables directly into
  5. MS Excel, including formatting, commands, macro calls, etc.
  6.  
  7. Demo project is attached to show how easy to drive it.
  8. The demo project creates the component explicitly so it can be
  9. tried without installing the component.
  10.  
  11.  
  12. Files:
  13.        EXCELS.PAS      Component source
  14.        EXCELS.INC      Include messages
  15.        EXCELS.DCR      Component resource for Delphi 1.0
  16.        EXCELS.D32      Component resource for Delphi 3.0 (rename to DCR)
  17.        EXCELDEM.DPR    Demo project
  18.        EXCELDEM.RES    Demo project resource
  19.        EXCELTOP.PAS    Demo dialog
  20.        EXCELTOP.DFM    Demo dialog format
  21.        EXCEL.XLS       Demo Excel macro collection
  22.        EXCEL.TXT       This file
  23.  
  24. TExcel is available at the following sites:
  25. (Thanks to Stefan Hoffmeister the sophisticated
  26. version named TAdvExcel is also available there.)
  27. Delphi Super Page
  28.             http://sunsite.icm.edu.pl/delphi/
  29.             http://www.cdrom.com/pub/delphi_www/
  30.             http://ring.aist.go.jp/archives/pc/delphi/
  31.             http://ftp.powerup.com.au/webmirror/delphi/
  32. Torry's Delphi Pages
  33.             http://carbohyd.siobc.ras.ru/torry/
  34.             http://www.deltacom.ru/torry/
  35.             http://torry.rimini.com/
  36.             http://www.torry.pp.ru/
  37.             http://www.snc.ru/~torry/
  38.  
  39.  
  40. ===================
  41. About Compatibility
  42. ===================
  43. Version 3.2 has left some methods and properties which became
  44. unnecessary due to Batch feature (see next section).
  45. Apart from this it is fully compatible to version 3.1 and 3.0.
  46.  
  47. ===================
  48. About Batch Feature
  49. ===================
  50. When huge amount of data must be transferred to Excel you can use
  51. the batch methods and properties. These are the following:
  52.  
  53.     procedure BatchStart(FirstRow, FirstCol: Integer);
  54.     procedure BatchSend;
  55.     procedure BatchCancel;
  56.     property Lines    : TStrings;
  57.     property BatchOn  : Boolean;
  58.     property BatchMin : Integer;
  59.     property BatchMax : Integer;
  60.     property FirstRow : Integer;
  61.     property LastCol  : Integer;
  62.  
  63. Each BatchStart must be followed by BatchSend or BatchCancel.
  64. After BatchStart the results of PutStr, PutExt, PutInt and
  65. PutDay methods are collected in Lines (TStringList).
  66. When the Lines.Count reaches BatchMax the first BatchMin
  67. lines are transferred to Excel and deleted from Lines,
  68. besides this FirstRow is increased.
  69. It is recommended to process output by rows.
  70.  
  71. BatchSend transfers all cells collected in Lines and calls
  72. BatchCancel which clears Lines.
  73.  
  74. WARNING!   In Excel the whole bounding rectangle (batch area) 
  75.            of the referred cells will be replaced.
  76. All not referred cells in the rectangle will be cleared.
  77.  
  78. FirstRow always shows which Excel row is the first in Lines.
  79.  
  80. LastCols shows the greatest cell index in the processed lines.
  81.  
  82. BachOn shows the batch status. When BatchOn is false or you
  83. refer a row less then FirstRow or column less then FirstCol
  84. the put methods (PutStr, PutExt, PutInt and PutDay) are
  85. directly executed.
  86.  
  87. Transfer speed can be increased if Lines are prepared.
  88. The cells must be separated by tab (#9) in each line (see demo).
  89.  
  90. Further speed increasing can be achieved
  91. if Excel is restored instead of minimized.
  92.  
  93. RESTRICTIONS! The Excel DDE buffer cannot be larger then 64 KB.
  94.               For Delphi 1.0 the length of lines cannot be
  95.               longer then 255 character including separators.
  96.               (See buffer checking in demo.)
  97.  
  98. ===============================
  99. About Receiving Data from Excel
  100. ===============================
  101. Though TExcel is to produce output to Excel sometimes input is
  102. also needed. GetCell retrieves the contents of the specified cell.
  103. When many cells needed it is recommended to use the GetRange method.
  104. GetRange returns the specified area of the current Excel worksheet
  105. in the stringlist given as Lines. Each cell is separated by tab (#9).
  106. RESTRICTIONS are the same as case of batch (see previous section)!
  107. WARNING! When Batch is on, cells in the batch area are NOT AVAILABLE!
  108.  
  109. ==================
  110. Excel DDE commands
  111. ==================
  112. To tell the truth I have never seen documentation of Excel DDE
  113. commands but I have found that most of Excel 4.0 macro instructions
  114. work as DDE commands. So all you have to do make a macro using the
  115. desired instruction in Excel 4.0 format and use it as DDE command.
  116. (With Excel 5.0 and 7.0  you can record macro in 4.0 format.)
  117. The demo project shows some samples in the "Command" combo box.
  118.  
  119.  
  120. =================================================================
  121. Instead of documentation here are some words about the interface.
  122. =================================================================
  123.  
  124. procedure Connect;
  125.   To connect Excel.
  126.  
  127. procedure Disconnect;
  128.   To disconnect Excel.
  129.  
  130. procedure Wait;
  131.   To wait for Excel to be ready.
  132.   Needed when more thousands commands are executed in a loop.
  133.  
  134. procedure ProcessMessages;
  135.   To permit Windows to process (Excel) messages.
  136.  
  137. function Request(const Item: string): string;
  138.   To request for a DDE item.
  139.   Use "SysItems" to get the available items.
  140.  
  141. procedure Exec(const Cmd : string);
  142.   To execute Excel commands. See section "Excel DDE Commands".
  143.  
  144. procedure Run(const Mn: string);
  145.   To execute a macro of the open macro file.
  146.  
  147. procedure Select(Row, Col: Integer);
  148.   To select a cell of the active Excel sheet.
  149.  
  150. procedure PutStr(Row, Col: Integer; const s: string);
  151.   To replace the cell with string.
  152.  
  153. procedure PutExt(Row, Col: Integer; e: Extended); virtual;
  154.   To replace the cell with real number.
  155.  
  156. procedure PutInt(Row, Col: Integer; i: Longint); virtual;
  157.   To replace the cell with integer.
  158.  
  159. procedure PutDay(Row, Col: Integer; d: TDateTime); virtual;
  160.   To replace the cell with date value.
  161.  
  162. procedure BatchStart;
  163.   To start processing. See section "About Batch...".
  164.  
  165. procedure BatchCancel;
  166.   To cancel batch processing. See section "About Batch...".
  167.  
  168. procedure BatchSend;
  169.   To finish batch processing. See section "About Batch...".
  170.  
  171. procedure GetRange(R: TRect; Lines: TStrings);
  172.   To receive many data from Excel. See section "About Receive...".
  173.  
  174. function GetCell(Row, Col: Integer): string;
  175.   To get the cell contents. See section "About Receive...".
  176.  
  177. procedure OpenMacroFile(const Fn: TFileName; Hide: Boolean);
  178.   To specify a macro file.
  179.   Needed only when macros are going to call.
  180.  
  181. procedure CloseMacroFile;
  182.    To close an opened macro file.
  183.    Only one macro file can be opened at the same time.
  184.  
  185. property DDE: TDdeCLientConv;
  186.   To handle DDE directly.  (Read only)
  187.   Normally not needed.
  188.  
  189. property Connected: Boolean;
  190.   To check connection.
  191.  
  192. property Ready: Boolean;
  193.   To check Excel status. (Read only)
  194.  
  195. property Selection: string;
  196.   To get current selection. (Read only)
  197.  
  198. property Lines : TStrings;
  199.   To handle batch strings directly. See section "About Batch...".
  200.  
  201. property FirstRow : Integer;
  202.   To check batch area. (Read only) See section "About Batch...".
  203.  
  204. property LastCol  : Integer;
  205.   To check or set batch area. See section "About Batch...".
  206.  
  207. property BatchOn  : Boolean;
  208.   To check batch status. (Read only) See section "About Batch...".
  209.  
  210. property ExeName: TFileName;
  211.   To set Excel path. If it is not set before connection
  212.   it will be set due to Windows Registry.
  213.  
  214. property Decimals: Integer;
  215.   To specify number format for real numbers.
  216.  
  217. property BatchMin : Integer;
  218.   To calibrate batch processing. See section "About Batch...".
  219.  
  220. property BatchMax : Integer;
  221.   To calibrate batch processing. See section "About Batch...".
  222.  
  223. property OnClose: TNotifyEvent;
  224.   Event handler called when Excel is connected.
  225.  
  226. property OnOpen: TNotifyEvent;
  227.   Event handler called when Excel is disconnected.
  228.  
  229.  
  230. --------------------------------------
  231. --------------------------------------
  232.  
  233. TExcel is provided free of charge as so long as
  234. it is not in commercial use. When it produces
  235. income for you, please send me some portion of
  236. your income (at least $50).      Thank you.
  237.  
  238. --------------------------------------
  239. --------------------------------------
  240. Tibor F. Liska     MTA SZTAKI
  241.                    Lßgymßnyosi utca 11
  242.                    1111 Budapest
  243.                    Hungary
  244. Fax:    +36-1-209-5288
  245. Tel:    +36-1-209-5284
  246. E-mail: liska@sztaki.hu
  247.