home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / UNIT123.ZIP / UNIT123.PAS
Encoding:
Pascal/Delphi Source File  |  1989-11-25  |  38.6 KB  |  1,177 lines

  1. {$N+}
  2. {$E+}
  3.  
  4. { This Unit will help you create simple Lotus Worksheet files (WKS).
  5.   To use this unit your main program file must be compiled with these
  6.   compiler directives $N+ and $E+. This allows Turpo Pascal to write
  7.   to the file the IEEE reals that 1-2-3 expects to find in its WKS files.
  8.  
  9.  
  10.   Written by Cody Laird, Atlanta, Ga.   (CompuServe# 70033,765)
  11.  
  12.   Many thanks to Jeff Walden, Author of "File Formats For Popular PC Software",
  13.   without his book this would not have been possible.
  14.  
  15.  
  16.   To use this unit correctly you must follow the following procedure calling
  17.   order to ensure that you create a file that Lotus can read:
  18.  
  19.   1) Call  open_wks_file(Lotus_File_Name,Version)
  20.  
  21.      were Lotus_File_Name is the full file name
  22.      (example: C:\TURBO\TEMP123.WKS ), and Version
  23.      is the number that corresponds to the following numbers:
  24.  
  25.             1028 = Version 1A and 1.0
  26.             1030 = Version 2.0
  27.  
  28.   2) Set up all of the column widths (if you want to define any other than
  29.      the default width of 9) by calling this sequence for each column:
  30.  
  31.          a)  set_column_width(c,w);
  32.          b)  write_lotus_rec;
  33.  
  34.      Then once your finished setting up all of the column widths, you
  35.      MUST call
  36.  
  37.           write_required_records;
  38.  
  39.      This writes 16 required records for the file. There all are default
  40.      values and should only be changes if you have a copy of the book
  41.      mentioned above. If you do not call this procedure Lotus will give
  42.      you an error message saying that part of the file is missing and
  43.      will not load any of the data.
  44.  
  45.  
  46.   3) Then repeat the following calls until your finished writing you data:
  47.  
  48.          a)  set_????_fields(parameters)
  49.          b)  write_lotus_rec;
  50.  
  51.          were ???? equals the basic type your placing in the cell, and
  52.          the parameters are the associated list for that type, as described
  53.          below.
  54.  
  55.   4) Call  close_wks_file  to close the Lotus WKS file. Your finished.
  56.  
  57.  
  58.   ********************************************************************
  59.   IMPORTANT NOTE: All of the records written to the file must have the
  60.                   Least Significant Byte FIRST. This includes OpCodes,
  61.                   Length Descriptors, and Data (except for characters)
  62.  
  63.                   This means that when you pass parameters to any of
  64.                   the  set_????_fields procedures  you must do so as
  65.                   follows:
  66.  
  67.                   Example:    set_blank_fields(SWAP(c),SWAP(r),f);
  68.  
  69.                   This only applies if the c or r varialbles are NOT
  70.                   hexadecimal constants. If you do not call SWAP(var)
  71.                   then your column or row numbers will be written in the
  72.                   wrong order for the file.
  73.  
  74.                   I do not understand why this happens but it does.
  75.                   This generally applies to all numbers that are passed
  76.                   to the procedures that are of type WORD.
  77.                   (ALL COLUMN and ROW NUMBERS, especially)
  78.  
  79.   *********************************************************************
  80.  
  81.   Notes to the set_????_fields procedures:
  82.  
  83.          In the following procedures, the following parameters have these
  84.          meanings:
  85.  
  86.             c = the column number (0 = A, 1 = B, 2 = C, etc...)
  87.             r = the row number    (0 = 1, 1 = 2, 2 = 3, etc...)
  88.             v = the value for the cell specified by (c,r)
  89.             f = the format for the cell (date,currency,percent,general, etc...)
  90.             s = the text for that cell (Label = Text)
  91.             lf= the alignment character for the text (Left,Centered,Right)
  92.             w = the width of the cell (1 to 255)
  93.  
  94.             These are specific to the set_window_fields procedure:
  95.  
  96.                   cw  = column width
  97.                   co  = columns on the screen
  98.                   ro  = rows on the screen
  99.                   lc  = leftmost column
  100.                   tr  = top row
  101.                   ntc = number of title columns
  102.                   ntr = number of title rows
  103.                   ltc = left title column
  104.                   ttr = top title column
  105.                   bc  = border column width
  106.                   br  = border row width
  107.                   ww  = window width
  108.  
  109.             Lotus_File_Name = the name of the file your creating
  110.             version = the version of the worksheet file (1028 or 1030)
  111.  
  112.     These are the set_????_fields procedures:
  113.  
  114.         1) set_real_fields(c,r:word;v:double;f:byte);  For REAL numbers
  115.  
  116.         2) set_int_fields(c,r:word;v:integer;f:byte);  For INTEGER numbers
  117.  
  118.         3) set_date_fields(c,r:word;date:str8);        For DATES (str8 = mm-dy-yr)
  119.  
  120.         4) set_label_fields(c,r:word;s:string;f:byte;lf:char); For LABELS, TEXT
  121.  
  122.         5) set_column_width(c:word;w:byte);  For setting the column widths
  123.  
  124.         6) set_blank_fields(c,r:word;f:byte); For setting up BLANK cells
  125.  
  126.         7) procedure set_window_fields
  127.            (c,r:word;f:byte;cw,co,ro,lc,tr,ntc,ntr,ltc,ttr,bcbr,ww:word);
  128.  
  129.            For setting up Window1
  130.  
  131.   *********************************************************************}
  132.  
  133.  
  134. unit Unit123;
  135. interface
  136. uses crt,dos;
  137.  
  138. const
  139.      Default_Format  = 127; {01111111 = Special, Default}
  140.      Date_Format     = 114; {01110010 = Special, dy-mth-yr format}
  141.      Currency_Format = 34;  {00100010 = Currency, 2 decimal places}
  142.      Percent_Format  = 50;  {00110010 = Percent, 2 decimal places}
  143.      Text_Format     = 117; {01110101 = Special, Text}
  144.      General_Format  = 113; {01110001 = Special, General}
  145.  
  146.                   {Add 128 to the above numbers to protect a cell}
  147.  
  148.      Label_Left      = #39; {'}
  149.      Label_Center    = #94; {^}
  150.      Label_Right     = #34; {"}
  151.  
  152.      Label_Length    = 32; {see end of file on limits on these two lengths}
  153.      Formula_Length  = 30;
  154.  
  155.  
  156. type
  157.  
  158.      BOF_Rec = record
  159.                      Ver_Lo : byte;
  160.                      Ver_Hi : byte;    {Least significant byte FIRST!!}
  161.                end;
  162.  
  163.      EOF_Rec = record  {0 bytes end of file record}
  164.                 end;
  165.  
  166.      Blank_Rec = record
  167.                        Fmt    : byte;
  168.                        Col_Lo : byte;
  169.                        Col_Hi : byte;
  170.                                         {only for formatted blank cells,
  171.                                          empty cells are not saved by Lotus}
  172.                        Row_Lo : byte;
  173.                        Row_Hi : byte;
  174.                  end;
  175.  
  176.      ColW1_Rec = record
  177.                        CNum_Lo : byte;
  178.                        CNum_Hi : byte;
  179.                        Cwth    : byte;
  180.                  end;
  181.  
  182.      Byte_Rec = record
  183.                        Byt : byte;
  184.                  end;
  185.  
  186.      Range_Rec = record
  187.                        S_Col_Lo : byte;
  188.                        S_Col_Hi : byte;
  189.                        S_Row_Lo : byte;
  190.                        S_Row_Hi : byte;
  191.                        E_Col_Lo : byte;
  192.                        E_Col_Hi : byte;
  193.                        E_Row_Lo : byte;
  194.                        E_Row_Hi : byte;
  195.                  end;
  196.  
  197.      Int_Rec = record
  198.                      Fmt    : byte;       {Format for the cell}
  199.                      Col_Lo : byte;
  200.                      Col_Hi : byte;       {Column number for the cell}
  201.                      Row_Lo : byte;
  202.                      Row_Hi : byte;       {Row number for the cell}
  203.                      Val    : integer;    {Value that goes in the cell}
  204.                 end;
  205.  
  206.      Real_Rec = record
  207.                       Fmt    : byte;
  208.                       Col_Lo : byte;
  209.                       Col_Hi : byte;
  210.                       Row_Lo : byte;
  211.                       Row_Hi : byte;
  212.                       Val    : double;  {must use the $N+,$E+ compiler directives}
  213.                 end;
  214.  
  215.      Label_Rec = record
  216.                        Fmt    : byte;
  217.                        Col_Lo : byte;
  218.                        Col_Hi : byte;
  219.                        Row_Lo : byte;
  220.                        Row_Hi : byte;
  221.                        Val    : array[0..Label_Length] of char;
  222.                                 {245 is the maximum length of a label string,
  223.                                  this is variable, change as needed}
  224.                 end;
  225.  
  226.       Formula_Rec = record
  227.                           Fmt       : byte;
  228.                           Col_Lo    : byte;
  229.                           Col_Hi    : byte;
  230.                           Row_Lo    : byte;
  231.                           Row_Hi    : byte;
  232.                           Val       : double;
  233.                           F_Size_Lo : byte;
  234.                           F_Size_Hi : byte;
  235.                           FArray    : array[0..Formula_Length] of byte;
  236.                      end;
  237.  
  238.       Window_Rec = record
  239.                          Cur_Col_Lo : byte;
  240.                          Cur_Col_Hi : byte;  {current cursor column}
  241.                          Cur_Row_Lo : byte;
  242.                          Cur_Row_Hi : byte;  {current cursor row}
  243.                          Fmt        : byte;  {cell format}
  244.                          Null1      : byte;  {unused but must be = to 0}
  245.                          Col_Wth_Lo : byte;  {column width}
  246.                          Col_Wth_Hi : byte;  {column width}
  247.                          Col_On_Lo  : byte;  {number of columns on screen}
  248.                          Col_On_Hi  : byte;  {number of columns on screen}
  249.                          Row_On_Lo  : byte;  {number of rows on screen}
  250.                          Row_On_Hi  : byte;  {number of rows on screen}
  251.                          L_Col_Lo   : byte;  {leftmost column}
  252.                          L_Col_Hi   : byte;  {leftmost column}
  253.                          T_Row_Lo   : byte;  {top row}
  254.                          T_Row_Hi   : byte;  {top row}
  255.                          NT_Col_Lo  : byte;  {number of title columns}
  256.                          NT_Col_Hi  : byte;  {number of title columns}
  257.                          NT_Row_Lo  : byte;  {number of title rows}
  258.                          NT_Row_Hi  : byte;  {number of title rows}
  259.                          LT_Col_Lo  : byte;  {left title column}
  260.                          LT_Col_Hi  : byte;  {left title column}
  261.                          TT_Row_Lo  : byte;  {top title row}
  262.                          TT_Row_Hi  : byte;  {top title row}
  263.                          BW_Col_Lo  : byte;  {border width column}
  264.                          BW_Col_Hi  : byte;  {border width column}
  265.                          BW_Row_Lo  : byte;  {border width row}
  266.                          BW_Row_Hi  : byte;  {border width row}
  267.                          Wdw_Wth_Lo : byte;  {window width}
  268.                          Wdw_Wth_Hi : byte;  {window width}
  269.                          Null2      : byte;  {unused but must be = to 0}
  270.                      end;
  271.  
  272. {Required Records}
  273.       Graph_Rec = record
  274.                         temp : array[0..436] of byte;
  275.                   end;
  276.       Table_Rec = record
  277.                         Fmt  : byte;
  278.                         temp : array[1..24] of byte;
  279.                   end;
  280.       QRange_Rec = record
  281.                         temp : array[0..23] of byte;
  282.                         Fmt  : byte;
  283.                   end;
  284.       HRange_Title_Rec = record
  285.                                temp : array[0..15] of byte;
  286.                          end;
  287.       KRange_Rec = record
  288.                          temp : array[0..8] of byte;
  289.                    end;
  290.       Footer_Header_Rec = record
  291.                                 temp : array[0..241] of byte;
  292.                           end;
  293.       SetUp_Rec = record
  294.                         temp : array[0..39] of byte;
  295.                   end;
  296.       Margin_Rec = record
  297.                          temp : array[0..9] of byte;
  298.                    end;
  299.  
  300.  
  301.       Lotus_Rec = record
  302.                         OP_Lo  : byte;
  303.                         OP_Hi  : byte;   {Least Significant Byte First!}
  304.                         Len_Lo : byte;
  305.                         Len_Hi : byte;
  306.                   end;
  307.  
  308.       Temp_Rec = record
  309.                        Hi : byte;  {used to cast a word onto}
  310.                        Lo : byte;
  311.                   end;
  312.  
  313.       str8 = string[8]; {used for date string}
  314.  
  315. var
  316.    ColNum,
  317.    RowNum        : word;       {column and row number used globally}
  318.    Lotus_File    : File;       {untyped file for Blockwrite}
  319.    S             : string;     {for the Labels or Text}
  320.    Lotus_Cell    : Lotus_Rec;  {OpCode and Record Length settings for one
  321.                                of the following record types:}
  322.    Lotus_Real    : Real_Rec;
  323.    Lotus_Int     : Int_Rec;
  324.    Lotus_Label   : Label_Rec;
  325.    Lotus_Col     : ColW1_Rec;
  326.    Lotus_Window  : Window_Rec;
  327.    Lotus_Formula : Formula_Rec;
  328.    Lotus_BOF     : BOF_Rec;
  329.    Lotus_EOF     : EOF_Rec;
  330.    Lotus_Blank   : Blank_Rec;
  331.    Lotus_Range   : Range_Rec;
  332.  
  333. {
  334.    Lotus_PRange  : Range_Rec;
  335.    Lotus_FRange  : Range_Rec;  All 8 bytes, same format, handled by one Record
  336.    Lotus_SRange  : Range_Rec;
  337. }
  338.  
  339.    Lotus_Byte    : Byte_Rec;
  340.  
  341. {
  342.    Lotus_CalcC   : Byte_Rec;
  343.    Lotus_CalcM   : Byte_Rec;
  344.    Lotus_CalcO   : Byte_Rec;   these are all the same size and can be handled
  345.    Lotus_Split   : Byte_Rec;   by one set_byte_fields procedure;
  346.    Lotus_Sync    : Byte_Rec;
  347.    Lotus_Protect : Byte_Rec;
  348.    Lotus_UnFmt   : Byte_Rec;
  349. }
  350.    Lotus_Table    : Table_Rec;
  351.    Lotus_QRange   : QRange_Rec;
  352.    Lotus_KRange   : KRange_Rec;
  353.    Lotus_HdFt     : Footer_Header_Rec;
  354.    Lotus_SetUp    : SetUp_Rec;
  355.    Lotus_Margin   : Margin_Rec;
  356.    Lotus_HrgTitle : HRange_Title_Rec;
  357.    Lotus_Graph    : Graph_Rec;
  358.  
  359.  
  360.  
  361.      BOF_Type,        {= $0000; OpCode for the Begining of File record}
  362.      EOF_Type,        {= $0100; {OpCode for the End of File record}
  363.      Formula_Type,    {= $1000; {OpCode for the Formula record}
  364.      CalcM_Type,      {= $0200; {OpCode for the Calcmode record}
  365.      CalcO_Type,      {= $0300; {OpCode for the Calcorder record}
  366.      Split_Type,      {= $0400; {OpCode for the Split record}
  367.      Sync_Type,       {= $0500; {OpCode for the Sync record}
  368.      Range_Type,      {= $0600; {OpCode for the Range record}
  369.      Window_Type,     {= $0700; {OpCode for the Window record}
  370.      ColW1_Type,      {= $0800; {OpCode for the Column width record}
  371.      Blank_Type,      {= $0C00; {OpCode for the Blank record}
  372.      Integer_Type,    {= $0D00; {OpCode for the integer record}
  373.      Real_Type,       {= $0E00; {OpCode for the real record}
  374.      Label_Type,      {= $0F00}
  375.      Table_Type,      {= $1800}
  376.      QRange_Type,     {= $1900}
  377.      PRange_Type,     {= $1A00}
  378.      SRange_Type,     {= $1B00}
  379.      FRange_Type,     {= $1C00}
  380.      KRange_Type,     {= $1D00}
  381.      HRange_Type,     {= $2000}
  382.      KRange2_Type,    {= $2300}
  383.      Protect_Type,    {= $2400}
  384.      Footer_Type,     {= $2500}
  385.      Header_Type,     {= $2600}
  386.      Setup_Type,      {= $2700}
  387.      Margin_Type,     {= $2800}
  388.      LabelFmt_Type,   {= $2900}
  389.      Title_Type,      {= $2A00}
  390.      Graph_Type,      {= $2D00}
  391.      CalcC_Type,      {= $2F00; {OpCode for the Calc count record}
  392.      UnFormat_Type:word; {= $3000}
  393.  
  394.      BOF_Len,         {= $0200; {Length of the Begining of File record}
  395.      EOF_Len,         {= $0000; {Length of the End of File record}
  396.      CalcM_Len,       {= $0100; {Length of the Calcmode record}
  397.      CalcO_Len,       {= $0100; {Length of the Calcorder record}
  398.      Split_Len,       {= $0100; {Length of the Split record}
  399.      Sync_Len,        {= $0100; {Length of the Sync record}
  400.      Range_Len,       {= $0800; {Length of the Range record}
  401.      Window_Len,      {= $1F00; {Length of the Window record}
  402.      ColW1_Len,       {= $0300; {Length of the Column width record}
  403.      Blank_Len,       {= $0500; {Length of the Blank record}
  404.      Integer_Len,     {= $0700; {Length of the integer record}
  405.      Real_Len,        {= $0D00; {Length of the real record}
  406.      Label_Len,       {= Label_Length}
  407.      Formula_Len,     {= Formula_Length}
  408.      CalcC_Len,       {= $0100; {Length of the Calc Count Record}
  409.      Table_Len,
  410.      QRange_Len,
  411.      PRange_Len,
  412.      SRange_Len,
  413.      FRange_Len,
  414.      KRange_Len,      {for these lengths see the end of this unit}
  415.      KRange2_Len,
  416.      Protec_Len,
  417.      Footer_Len,      {Header_Len = same}
  418.      Setup_Len,
  419.      Margin_Len,
  420.      LabelFmt_Len,
  421.      Title_Len,       {HRange = same}
  422.      Graph_Len    : word;
  423.  
  424. procedure open_wks_file
  425.      (Lotus_File_Name:PathStr;version,NumofCol,NumofRow:word); {call first}
  426.  
  427. procedure write_required_records; {call after setting up the column widths}
  428.  
  429. procedure close_wks_file;  {call last}
  430.  
  431.  
  432. {call as many of these as required AFTER calling write_required_records}
  433.  
  434. procedure set_real_fields(c,r:word;v:double;f:byte);
  435. procedure set_int_fields(c,r:word;v:integer;f:byte);
  436. procedure set_date_fields(c,r:word;date:str8);
  437. procedure set_label_fields(c,r:word;s:string;f:byte;lf:char);
  438. procedure set_column_width(c:word;w:byte);
  439. procedure set_blank_fields(c,r:word;f:byte);
  440. procedure set_window_fields
  441.           (c,r:word;f:byte;cw,co,ro,lc,tr,ntc,ntr,ltc,ttr,bc,br,ww:word);
  442. procedure set_byte_fields(OpCode:word);
  443. procedure set_range_fields(c,r:word);
  444. procedure write_lotus_rec;
  445.  
  446. implementation
  447.  
  448. procedure set_bof_rec(version:word);
  449. begin
  450.        with Lotus_Cell do begin
  451.             OP_Lo  := Temp_Rec(BOF_Type).Lo;
  452.             OP_Hi  := Temp_Rec(BOF_Type).Hi;
  453.             Len_Lo := Temp_Rec(BOF_Len).Lo;
  454.             Len_Hi := Temp_Rec(BOF_Len).Hi;
  455.        end;
  456.        with Lotus_BOF do begin
  457.                  Ver_Lo := Temp_Rec(version).Lo;
  458.                  Ver_Hi := Temp_Rec(version).Hi;
  459.        end;
  460. end;
  461.  
  462. procedure set_eof_rec;
  463. begin
  464.        with Lotus_Cell do begin
  465.             OP_Lo  := Temp_Rec(EOF_Type).Lo;
  466.             OP_Hi  := Temp_Rec(EOF_Type).Hi;
  467.             Len_Lo := Temp_Rec(EOF_Len).Lo;
  468.             Len_Hi := Temp_Rec(EOF_Len).Hi;
  469.        end;
  470. end;
  471.  
  472. function Cal_julian(date:str8):real; {date is in the format mm/dd/yr}
  473. var ercode:integer;
  474.     mth,yr,day,y1,pv:real;
  475. begin
  476.      val(copy(date,7,2),yr,ercode);   {get the value of the year}
  477.      val(copy(date,4,2),day,ercode);  {get the value of the day}
  478.      val(copy(date,1,2),mth,ercode);  {get the value of the month}
  479.      pv := 7.5/12;
  480.      yr := yr + 1900;                 {convert to 19XX format}
  481.      y1 := yr + (mth - 2.85)/12;
  482.      Cal_Julian := int(int(int(367.0 * y1) - int(y1) - 0.75 * int(y1) + day) - 0.75 *2.0) + 1721115.0 + 9800;
  483. end;
  484.  
  485. procedure set_date_fields(c,r:word;date:str8);
  486. begin
  487.      with Lotus_Cell do begin
  488.             OP_Lo  := Temp_Rec(Real_Type).Lo;
  489.             OP_Hi  := Temp_Rec(Real_Type).Hi;
  490.             Len_Lo := Temp_Rec(Real_Len).Lo;
  491.             Len_Hi := Temp_Rec(Real_Len).Hi;
  492.      end;
  493.      with Lotus_Real do begin
  494.                Fmt    := Date_Format;
  495.                Col_Hi := Temp_Rec(c).Hi;
  496.                Col_Lo := Temp_Rec(c).Lo;
  497.                Row_Hi := Temp_Rec(r).Hi;
  498.                Row_Lo := Temp_Rec(r).Lo;
  499.                Val    := (Cal_Julian(date)-2424832); {this converts the date to
  500.                                                          a Lotus date number}
  501.       end;
  502. end;
  503.  
  504. procedure set_int_fields(c,r:word;v:integer;f:byte);
  505. begin
  506.      with Lotus_Cell do begin
  507.             OP_Lo  := Temp_Rec(Integer_Type).Lo;
  508.             OP_Hi  := Temp_Rec(Integer_Type).Hi;
  509.             Len_Lo := Temp_Rec(Integer_Len).Lo;
  510.             Len_Hi := Temp_Rec(Integer_Len).Hi;
  511.      end;
  512.      with Lotus_Int do begin
  513.  
  514.                Fmt := f;
  515.                Col_Lo := Temp_Rec(c).Lo;
  516.                Col_Hi := Temp_Rec(c).Hi;
  517.                Row_Hi := Temp_Rec(r).Hi;
  518.                Row_Lo := Temp_Rec(r).Lo;
  519.                Val := v;
  520.      end;
  521. end;
  522.  
  523. procedure set_real_fields(c,r:word;v:double;f:byte);
  524. begin
  525.      with Lotus_Cell do begin
  526.             OP_Lo  := Temp_Rec(Real_Type).Lo;
  527.             OP_Hi  := Temp_Rec(Real_Type).Hi;
  528.             Len_Lo := Temp_Rec(Real_Len).Lo;
  529.             Len_Hi := Temp_Rec(Real_Len).Hi;
  530.      end;
  531.      with Lotus_Real do begin
  532.                Fmt := f;
  533.                Col_Lo := Temp_Rec(c).Lo;
  534.                Col_Hi := Temp_Rec(c).Hi;
  535.                Row_Hi := Temp_Rec(r).Hi;
  536.                Row_Lo := Temp_Rec(r).Lo;
  537.                Val := v;
  538.      end;
  539. end;
  540.  
  541. procedure set_label_fields(c,r:word;s:string;f:byte;lf:char);
  542. var i : byte; l : word;
  543. begin
  544.      s := s + #0;
  545.      l := Length(s);
  546.      with Lotus_Cell do begin
  547.             OP_Lo  := Temp_Rec(Label_Type).Lo;
  548.             OP_Hi  := Temp_Rec(Label_Type).Hi;
  549.             Len_Lo := Temp_Rec(Label_len).hi;
  550.             Len_Hi := Temp_Rec(Label_len).lo;
  551.      end;
  552.      with Lotus_Label do begin
  553.                Fmt    := f;
  554.                Col_Lo := Temp_Rec(c).Lo;
  555.                Col_Hi := Temp_Rec(c).Hi;
  556.                Row_Hi := Temp_Rec(r).Hi;
  557.                Row_Lo := Temp_Rec(r).Lo;
  558.                Val[0] := lf;
  559.                for i := 1 to Label_Length do
  560.                    Val[i] := #0;
  561.                for i := 1 to l do
  562.                    Val[i] := s[i];
  563.      end;
  564. end;
  565.  
  566. procedure set_column_width(c:word;w:byte);
  567. begin
  568.        with Lotus_Cell do begin
  569.             OP_Lo  := Temp_Rec(ColW1_Type).Lo;
  570.             OP_Hi  := Temp_Rec(ColW1_Type).Hi;
  571.             Len_Lo := Temp_Rec(ColW1_Len).Lo;
  572.             Len_Hi := Temp_Rec(ColW1_Len).Hi;
  573.        end;
  574.        with Lotus_Col do begin
  575.                  CNum_Lo := Temp_Rec(c).Lo;
  576.                  CNum_Hi := Temp_Rec(c).Hi;
  577.                  Cwth    := w;
  578.        end;
  579. end;
  580.  
  581. procedure set_window_fields
  582.           (c,r:word;f:byte;cw,co,ro,lc,tr,ntc,ntr,ltc,ttr,bc,br,ww:word);
  583. begin
  584.      with Lotus_Cell do begin
  585.             OP_Lo  := Temp_Rec(Window_Type).Lo;
  586.             OP_Hi  := Temp_Rec(Window_Type).Hi;
  587.             Len_Lo := Temp_Rec(Window_Len).Lo;
  588.             Len_Hi := Temp_Rec(Window_Len).Hi;
  589.      end;
  590.      with Lotus_Window do begin
  591.                Fmt        := f;
  592.                Null1      := $00;
  593.                Null2      := $00;
  594.                Cur_Col_Lo := Temp_Rec(c).Lo;
  595.                Cur_Col_Hi := Temp_Rec(c).Hi;
  596.                Cur_Row_Lo := Temp_Rec(r).Lo;
  597.                Cur_Row_Hi := Temp_Rec(r).Hi;
  598.                Col_Wth_Lo := Temp_Rec(cw).Lo;
  599.                Col_Wth_Hi := Temp_Rec(cw).Hi;
  600.                Col_On_Lo  := Temp_Rec(co).Lo;
  601.                Col_On_Hi  := Temp_Rec(co).Hi;
  602.                Row_On_Lo  := Temp_Rec(ro).Lo;
  603.                Row_On_Hi  := Temp_Rec(ro).Hi;
  604.                L_Col_Lo   := Temp_Rec(lc).Lo;
  605.                L_Col_Hi   := Temp_Rec(lc).Hi;
  606.                T_Row_Lo   := Temp_Rec(tr).Lo;
  607.                T_Row_Hi   := Temp_Rec(tr).Hi;
  608.                NT_Col_Lo  := Temp_Rec(ntc).Lo;
  609.                NT_Col_Hi  := Temp_Rec(ntc).Hi;
  610.                NT_Row_Lo  := Temp_Rec(ntr).Lo;
  611.                NT_Row_Hi  := Temp_Rec(ntr).Hi;
  612.                LT_Col_Lo  := Temp_Rec(ltc).Lo;
  613.                LT_Col_Hi  := Temp_Rec(ltc).Hi;
  614.                TT_Row_Lo  := Temp_Rec(ttr).Lo;
  615.                TT_Row_Hi  := Temp_Rec(ttr).Hi;
  616.                BW_Col_Lo  := Temp_Rec(bc).Lo;
  617.                BW_Col_Hi  := Temp_Rec(bc).Hi;
  618.                BW_Row_Lo  := Temp_Rec(br).Lo;
  619.                BW_Row_Hi  := Temp_Rec(br).Hi;
  620.                Wdw_Wth_Lo := Temp_Rec(ww).Lo;
  621.                Wdw_Wth_Hi := Temp_Rec(ww).Hi;
  622.      end;
  623. end;
  624.  
  625. procedure set_blank_fields(c,r:word;f:byte);
  626. begin
  627.      with Lotus_Cell do begin
  628.             OP_Lo  := Temp_Rec(Blank_Type).Lo;
  629.             OP_Hi  := Temp_Rec(Blank_Type).Hi;
  630.             Len_Lo := Temp_Rec(Blank_Len).Lo;
  631.             Len_Hi := Temp_Rec(Blank_Len).Hi;
  632.      end;
  633.      with Lotus_Blank do begin
  634.                Fmt := f;
  635.                Col_Lo := Temp_Rec(c).Lo;
  636.                Col_Hi := Temp_Rec(c).Hi;
  637.                Row_Lo := Temp_Rec(r).Lo;
  638.                Row_Hi := Temp_Rec(r).Hi;
  639.      end;
  640. end;
  641.  
  642. procedure set_byte_fields(OpCode:word);
  643. var l : word;
  644. begin
  645.      l := $0100;
  646.      with Lotus_Cell do begin
  647.             OP_Lo  := Temp_Rec(OpCode).Lo;
  648.             OP_Hi  := Temp_Rec(OpCode).Hi;
  649.             Len_Lo := Temp_Rec(l).Lo;
  650.             Len_Hi := Temp_Rec(l).Hi;
  651.      end;
  652.      case OpCode of
  653.           $0200, $0500  : Lotus_Byte.Byt := $FF; {'$00 is Manual Recalc, Window
  654.                                                   not syncronized}
  655.           $0300, $0400,
  656.           $2400, $2F00,
  657.           $3000         : Lotus_Byte.Byt := $00; {'$01 is Recalc by Col and
  658.                                                   Split Vertically,
  659.                                                   '$FF is Recalc by Row and
  660.                                                    Split Horizontally}
  661.           $2900         : Lotus_Byte.Byt := $27;
  662.      end;
  663. end;
  664.  
  665. procedure set_range_fields(c,r:word);
  666. begin
  667.      with Lotus_Cell do begin
  668.             OP_Lo  := Temp_Rec(Range_Type).Lo;
  669.             OP_Hi  := Temp_Rec(Range_Type).Hi;
  670.             Len_Lo := Temp_Rec(Range_Len).Lo;
  671.             Len_Hi := Temp_Rec(Range_Len).Hi;
  672.      end;
  673.      with Lotus_Range do begin
  674.                S_Col_Lo := $00; {Column A, Row 1}
  675.                S_Col_Hi := $00; {Column A, Row 1}
  676.                S_Row_Lo := $00;
  677.                S_Row_Hi := $00;
  678.                E_Col_Lo := Temp_Rec(c).Lo;
  679.                E_Col_Hi := Temp_Rec(c).Hi;
  680.                E_Row_Lo := Temp_Rec(r).Lo;
  681.                E_Row_Hi := Temp_Rec(r).Hi;
  682.      end;
  683. end;
  684.  
  685. procedure set_PFSranges_fields(OpCode:word);
  686. begin
  687.      with Lotus_Cell do begin
  688.             OP_Lo  := Temp_Rec(OpCode).Lo;
  689.             OP_Hi  := Temp_Rec(OpCode).Hi;
  690.             Len_Lo := Temp_Rec(Range_Len).Lo;
  691.             Len_Hi := Temp_Rec(Range_Len).Hi;
  692.      end;
  693.      with Lotus_Range do begin
  694.                S_Col_Lo := $FF;
  695.                S_Col_Hi := $FF;
  696.                S_Row_Lo := $00;
  697.                S_Row_Hi := $00;   {Default settings}
  698.                E_Col_Lo := $FF;
  699.                E_Col_Hi := $FF;
  700.                E_Row_Lo := $00;
  701.                E_Row_Hi := $00;
  702.      end;
  703. end;
  704.  
  705. procedure set_table_fields;
  706. var i : byte;
  707. begin
  708.      with Lotus_Cell do begin
  709.             OP_Lo  := Temp_Rec(Table_Type).Lo;
  710.             OP_Hi  := Temp_Rec(Table_Type).Hi;
  711.             Len_Lo := Temp_Rec(Table_Len).Lo;
  712.             Len_Hi := Temp_Rec(Table_Len).Hi;
  713.      end;
  714.      with Lotus_Table do begin
  715.           Fmt := $00;
  716.           i := 1;
  717.           while i < 22 do begin
  718.               temp[i]   := $FF;
  719.               temp[i+1] := $FF;
  720.               i := i + 4;
  721.           end;
  722.           i := 3;
  723.           while i < 24 do begin
  724.               temp[i]   := $00;
  725.               temp[i+1] := $00;
  726.               i := i + 4;
  727.           end;
  728.       end;
  729. end;
  730.  
  731. procedure set_qrange_fields;
  732. var i : byte;
  733. begin
  734.      with Lotus_Cell do begin
  735.             OP_Lo  := Temp_Rec(QRange_Type).Lo;
  736.             OP_Hi  := Temp_Rec(QRange_Type).Hi;
  737.             Len_Lo := Temp_Rec(QRange_Len).Lo;
  738.             Len_Hi := Temp_Rec(QRange_Len).Hi;
  739.      end;
  740.      with Lotus_QRange do begin
  741.           i := 0;
  742.           while i < 21 do begin
  743.               temp[i]   := $FF;
  744.               temp[i+1] := $FF;
  745.               i := i + 4;
  746.           end;
  747.           i := 2;
  748.           while i < 23 do begin
  749.               temp[i]   := $00;
  750.               temp[i+1] := $00;
  751.               i := i + 4;
  752.           end;
  753.           Fmt := $00;
  754.       end;
  755. end;
  756.  
  757. procedure set_Kranges_fields(OpCode:word);
  758. var i : byte;
  759. begin
  760.      with Lotus_Cell do begin
  761.             OP_Lo  := Temp_Rec(OpCode).Lo;
  762.             OP_Hi  := Temp_Rec(OpCode).Hi;
  763.             Len_Lo := Temp_Rec(KRange_Len).Lo;
  764.             Len_Hi := Temp_Rec(KRange_Len).Hi;
  765.      end;
  766.      with Lotus_KRange do begin
  767.           i := 0;
  768.           while i < 5 do begin
  769.               temp[i]   := $FF;
  770.               temp[i+1] := $FF;
  771.               i := i + 4;
  772.           end;
  773.           i := 2;
  774.           while i < 7 do begin
  775.               temp[i]   := $00;
  776.               temp[i+1] := $00;
  777.               i := i + 4;
  778.           end;
  779.           temp[8] := $27;
  780.      end;
  781. end;
  782.  
  783. procedure set_HrgTitle_fields(OpCode:word);
  784. var i : byte;
  785. begin
  786.      with Lotus_Cell do begin
  787.             OP_Lo  := Temp_Rec(OpCode).Lo;
  788.             OP_Hi  := Temp_Rec(OpCode).Hi;
  789.             Len_Lo := Temp_Rec(Title_Len).Lo; {doubles for HRange_Len also}
  790.             Len_Hi := Temp_Rec(Title_Len).Hi;
  791.      end;
  792.      with Lotus_HRgTitle do begin
  793.           i := 0;
  794.           while i < 13 do begin
  795.               temp[i]   := $FF;
  796.               temp[i+1] := $FF;
  797.               i := i + 4;
  798.           end;
  799.           i := 2;
  800.           while i < 15 do begin
  801.               temp[i]   := $00;
  802.               temp[i+1] := $00;
  803.               i := i + 4;
  804.           end;
  805.      end;
  806. end;
  807.  
  808. procedure set_footer_header_fields(OpCode:word);
  809. var i : byte;
  810. begin
  811.      with Lotus_Cell do begin
  812.             OP_Lo  := Temp_Rec(OpCode).Lo;
  813.             OP_Hi  := Temp_Rec(OpCode).Hi;
  814.             Len_Lo := Temp_Rec(Footer_len).Lo;
  815.             Len_Hi := Temp_Rec(Footer_Len).Hi;
  816.      end;
  817.      with Lotus_HdFt do
  818.           for i := 0 to 241 do
  819.               temp[i] := $00;
  820. end;
  821.  
  822. procedure set_setup_fields;
  823. var i : byte;
  824. begin
  825.      with Lotus_Cell do begin
  826.             OP_Lo  := Temp_Rec(SetUp_Type).Lo;
  827.             OP_Hi  := Temp_Rec(SetUp_Type).Hi;
  828.             Len_Lo := Temp_Rec(SetUp_Len).Lo;
  829.             Len_Hi := Temp_Rec(SetUp_Len).Hi;
  830.      end;
  831.      with Lotus_SetUp do begin
  832.           temp[0] := $00;
  833.           for i := 1 to 39 do
  834.               temp[i] := $20;
  835.      end;
  836. end;
  837.  
  838. procedure set_margin_fields;
  839. var i : byte;
  840. begin
  841.      with Lotus_Cell do begin
  842.             OP_Lo  := Temp_Rec(Margin_Type).Lo;
  843.             OP_Hi  := Temp_Rec(Margin_Type).Hi;
  844.             Len_Lo := Temp_Rec(Margin_Len).Lo;
  845.             Len_Hi := Temp_Rec(Margin_Len).Hi;
  846.      end;
  847.      with Lotus_Margin do begin
  848.           for i := 0 to 9 do
  849.               temp[i] := $00;
  850.           temp[0] := $04;
  851.           temp[2] := $4C;
  852.           temp[4] := $42;
  853.           temp[6] := $02;
  854.           temp[8] := $02;
  855.      end;
  856. end;
  857.  
  858. procedure set_graph_fields;
  859. var i : integer;
  860. begin
  861.      with Lotus_Cell do begin
  862.             OP_Lo  := Temp_Rec(Graph_Type).Lo;
  863.             OP_Hi  := Temp_Rec(Graph_Type).Hi;
  864.             Len_Lo := Temp_Rec(Graph_Len).Lo;
  865.             Len_Hi := Temp_Rec(Graph_Len).Hi;
  866.      end;
  867.      with Lotus_Graph do begin
  868.           i := 0;
  869.           while i < 101 do begin
  870.               temp[i]   := $FF;
  871.               temp[i+1] := $FF;
  872.               i := i + 4;
  873.           end;
  874.           i := 2;
  875.           while i < 103 do begin
  876.               temp[i]   := $00;
  877.               temp[i+1] := $00;
  878.               i := i + 4;
  879.           end;
  880.           temp[104] := $04;
  881.           temp[105] := $00;
  882.           temp[106] := $00;
  883.           for i := 107 to 112 do
  884.               temp[i] := $03;
  885.           for i := 113 to 432 do
  886.               temp[i] := $00;
  887.           temp[433] := $71;
  888.           temp[434] := $71;
  889.           temp[435] := $01;
  890.           temp[436] := $00;
  891.       end;
  892. end;
  893.  
  894. procedure write_graph_rec;
  895. begin
  896.      BlockWrite(Lotus_File,Lotus_Graph,437);
  897. end;
  898.  
  899. procedure write_margin_rec;
  900. begin
  901.      BlockWrite(Lotus_File,Lotus_Margin,10);
  902. end;
  903.  
  904. procedure write_setup_rec;
  905. begin
  906.      BlockWrite(Lotus_File,Lotus_SetUp,40);
  907. end;
  908.  
  909. procedure write_footer_header_rec;
  910. begin
  911.      BlockWrite(Lotus_File,Lotus_HdFt,242);
  912. end;
  913.  
  914. procedure write_table_rec;
  915. begin
  916.      BlockWrite(Lotus_File,Lotus_Table,25);
  917. end;
  918.  
  919. procedure write_qrange_rec;
  920. begin
  921.      BlockWrite(Lotus_File,Lotus_QRange,25);
  922. end;
  923.  
  924. procedure write_Krange_rec;
  925. begin
  926.      BlockWrite(Lotus_File,Lotus_KRange,9);
  927. end;
  928.  
  929. procedure write_HrgTitle_rec;
  930. begin
  931.      BlockWrite(Lotus_File,Lotus_HRgTitle,16);
  932. end;
  933.  
  934. procedure write_bof_rec;
  935. begin
  936.      BlockWrite(Lotus_File,Lotus_BOF,2);
  937. end;
  938.  
  939. procedure write_eof_rec;
  940. begin
  941.      BlockWrite(Lotus_File,Lotus_EOF,0);
  942. end;
  943.  
  944. procedure write_int_rec;
  945. begin
  946.      BlockWrite(Lotus_File,Lotus_Int,7);
  947. end;
  948.  
  949. procedure write_real_rec;
  950. begin
  951.      BlockWrite(Lotus_File,Lotus_Real,13);
  952. end;
  953.  
  954. procedure write_label_rec;
  955. begin
  956.      BlockWrite(Lotus_File,Lotus_Label,Label_length);
  957. end;
  958.  
  959. procedure write_column_rec;
  960. begin
  961.      BlockWrite(Lotus_File,Lotus_Col,3);
  962. end;
  963.  
  964. procedure write_blank_rec;
  965. begin
  966.      BlockWrite(Lotus_File,Lotus_Blank,5);
  967. end;
  968.  
  969. procedure write_window_rec;
  970. begin
  971.      BlockWrite(Lotus_File,Lotus_Window,31);
  972. end;
  973.  
  974. procedure write_formula_rec;
  975. begin
  976.      BlockWrite(Lotus_File,Lotus_Formula,(Formula_Length+15));
  977. end;
  978.  
  979. procedure write_byte_rec;
  980. begin
  981.      BlockWrite(Lotus_File,Lotus_Byte,1);
  982. end;
  983.  
  984. procedure write_range_rec;
  985. begin
  986.      BlockWrite(Lotus_File,Lotus_Range,8);
  987. end;
  988.  
  989. procedure write_lotus_rec;
  990. begin
  991.      BlockWrite(Lotus_File,Lotus_Cell,4);
  992.      case Lotus_Cell.Op_Lo of
  993.           $00     : write_bof_rec;
  994.           $01     : write_eof_rec;
  995.           $02,
  996.           $03,
  997.           $04,
  998.           $05,
  999.           $24,
  1000.           $29,
  1001.           $2F,
  1002.           $30     : write_byte_rec;
  1003.           $1A,
  1004.           $1B,
  1005.           $1C,
  1006.           $06     : write_range_rec;
  1007.           $07     : write_window_rec;
  1008.           $08     : write_column_rec;
  1009.           $0C     : write_blank_rec;
  1010.           $0D     : write_int_rec;
  1011.           $0E     : write_real_rec;
  1012.           $0F     : write_label_rec;
  1013.           $10     : write_formula_rec;
  1014.           $18     : write_table_rec;
  1015.           $19     : write_qrange_rec;
  1016.           $1D,
  1017.           $23     : write_Krange_rec;
  1018.           $25,
  1019.           $26     : write_footer_header_rec;
  1020.           $27     : write_setup_rec;
  1021.           $28     : write_margin_rec;
  1022.           $2A,
  1023.           $20     : write_HrgTitle_rec;
  1024.           $2D     : write_graph_rec;
  1025.      end;
  1026. end;
  1027.  
  1028. procedure open_wks_file(Lotus_File_Name:PathStr;version,NumofCol,NumofRow:word);
  1029. begin
  1030.      assign(Lotus_File,Lotus_File_Name);
  1031.      rewrite(Lotus_File,1);
  1032.      set_bof_rec(version);
  1033.      write_lotus_rec;
  1034.      set_range_fields(NumofCol,NumofRow);
  1035.      write_lotus_rec;
  1036.      set_byte_fields(CalcC_Type);
  1037.      write_lotus_rec;
  1038.      set_byte_fields(CalcM_Type); {calmode}
  1039.      write_lotus_rec;
  1040.      set_byte_fields(CalcO_Type); {calcorder}
  1041.      write_lotus_rec;
  1042.      set_byte_fields(Split_Type); {split}
  1043.      write_lotus_rec;
  1044.      set_byte_fields(Sync_Type);  {sync}
  1045.      write_lotus_rec;
  1046.  
  1047.      {The following is a default window setting. To set your own window
  1048.       settings remove the next three lines and make your own calls to
  1049.       set_window_fields and write_lotus_rec from within your program}
  1050.  
  1051.      set_window_fields($0000,$0000,$71,$0900,$0600,$1400,$0000,$0000,$0000,
  1052.                        $0000,$0000,$0000,$0400,$0400,$4800);
  1053.      write_lotus_rec;
  1054.  
  1055. end;
  1056.  
  1057. procedure write_required_records;
  1058. begin
  1059.      set_table_fields;
  1060.      write_lotus_rec;
  1061.      set_Qrange_fields;
  1062.      write_lotus_rec;
  1063.      set_pfsranges_fields(PRange_Type);
  1064.      write_lotus_rec;
  1065.      set_byte_fields(UnFormat_Type);
  1066.      write_lotus_rec;
  1067.      set_pfsranges_fields(FRange_Type);
  1068.      write_lotus_rec;
  1069.      set_pfsranges_fields(SRange_Type);
  1070.      write_lotus_rec;
  1071.      set_Kranges_fields(KRange_Type);
  1072.      write_lotus_rec;
  1073.      set_Kranges_fields(KRange2_Type);
  1074.      write_lotus_rec;
  1075.      set_HRgTitle_fields(HRange_Type);
  1076.      write_lotus_rec;
  1077.      set_byte_fields(Protect_Type);
  1078.      write_lotus_rec;
  1079.      set_footer_header_fields(Footer_Type);
  1080.      write_lotus_rec;
  1081.      set_footer_header_fields(Header_Type);
  1082.      write_lotus_rec;
  1083.      set_setup_fields;
  1084.      write_lotus_rec;
  1085.      set_margin_fields;
  1086.      write_lotus_rec;
  1087.      set_byte_fields(LabelFmt_Type);
  1088.      write_lotus_rec;
  1089.      set_HRgTitle_fields(Title_Type);
  1090.      write_lotus_rec;
  1091.      set_graph_fields;
  1092.      write_lotus_rec;
  1093. end;
  1094.  
  1095.  
  1096. procedure close_wks_file;
  1097. begin
  1098.      set_eof_rec;
  1099.      write_lotus_rec;
  1100.      close(Lotus_File);
  1101. end;
  1102.  
  1103. begin
  1104.      BOF_Type        := $0000; {OpCode for the Begining of File record}
  1105.      EOF_Type        := $0100; {OpCode for the End of File record}
  1106.      Formula_Type    := $1000; {OpCode for the Formula record}
  1107.      CalcM_Type      := $0200; {OpCode for the Calcmode record}
  1108.      CalcO_Type      := $0300; {OpCode for the Calcorder record}
  1109.      Split_Type      := $0400; {OpCode for the Split record}
  1110.      Sync_Type       := $0500; {OpCode for the Sync record}
  1111.      Range_Type      := $0600; {OpCode for the Range record}
  1112.      Window_Type     := $0700; {OpCode for the Window record}
  1113.      ColW1_Type      := $0800; {OpCode for the Column width record}
  1114.      Blank_Type      := $0C00; {OpCode for the Blank record}
  1115.      Integer_Type    := $0D00; {OpCode for the integer record}
  1116.      Real_Type       := $0E00; {OpCode for the real record}
  1117.      Label_Type      := $0F00; {OpCode for the label record}
  1118.      CalcC_Type      := $2F00; {OpCode for the Calc count record}
  1119.      Table_Type      := $1800;
  1120.      QRange_Type     := $1900;
  1121.      PRange_Type     := $1A00;
  1122.      SRange_Type     := $1B00;
  1123.      FRange_Type     := $1C00;
  1124.      KRange_Type     := $1D00;
  1125.      HRange_Type     := $2000;
  1126.      KRange2_Type    := $2300;
  1127.      Protect_Type    := $2400;
  1128.      Footer_Type     := $2500;
  1129.      Header_Type     := $2600;
  1130.      Setup_Type      := $2700;
  1131.      Margin_Type     := $2800;
  1132.      LabelFmt_Type   := $2900;
  1133.      Title_Type      := $2A00;
  1134.      Graph_Type      := $2D00;
  1135.      UnFormat_Type   := $3000;
  1136.  
  1137.      BOF_Len         := $0200; {Length of the Begining of File record}
  1138.      EOF_Len         := $0000; {Length of the End of File record}
  1139.      CalcM_Len       := $0100; {Length of the Calcmode record}
  1140.      CalcO_Len       := $0100; {Length of the Calcorder record}
  1141.      CalcC_Len       := $0100; {Length of the CalcCount record}
  1142.      Split_Len       := $0100; {Length of the Split record}
  1143.      Sync_Len        := $0100; {Length of the Sync record}
  1144.      Range_Len       := $0800; {Length of the Range record}
  1145.      Window_Len      := $1F00; {Length of the Window record}
  1146.      ColW1_Len       := $0300; {Length of the Column width record}
  1147.      Blank_Len       := $0500; {Length of the Blank record}
  1148.      Integer_Len     := $0700; {Length of the integer record}
  1149.      Real_Len        := $0D00; {Length of the real record}
  1150.  
  1151.      Table_Len      := $1900;
  1152.      QRange_Len     := $1900;
  1153.      PRange_Len     := $0800;
  1154.      SRange_Len     := $0800;
  1155.      FRange_Len     := $0800;
  1156.      KRange_Len     := $0900;
  1157. {    HRange_Len     := $1000; }
  1158.      KRange2_Len    := $0900;
  1159.      Protec_Len     := $0100;
  1160.      Footer_Len     := $F200;
  1161. {    Header_Len     := $F200; }
  1162.      Setup_Len      := $2800;
  1163.      Margin_Len     := $0A00;
  1164.      LabelFmt_Len   := $0100;
  1165.      Title_Len      := $1000;
  1166.      Graph_Len      := $B501;
  1167.  
  1168. {
  1169.      Label_Length    = 32;
  1170.               maximum length for a label string is 245, change as needed
  1171.      Formula_Length  = 30;
  1172.               maximum length for a formula series is 2047, change as needed
  1173. }
  1174.      Label_Len       := Label_Length;
  1175.      Formula_Len     := Formula_Length;
  1176.  
  1177. end.