home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
basic
/
library
/
pb
/
library4
/
read123.bas
< prev
next >
Wrap
BASIC Source File
|
1994-04-11
|
3KB
|
103 lines
'Read123.bas
DEFINT A-Z
DECLARE SUB GetFormat (Format, Row, Column)
DIM SHARED FileNum
DIM SHARED CellFmt AS STRING * 1
CLS
DO
INPUT "Enter name of Lotus file to read: ", FileName$
IF FileName$ = "" THEN FILES "*.w?"
LOOP UNTIL LEN(FileName$)
FileNum = FREEFILE
OPEN FileName$ FOR BINARY AS #FileNum
DO UNTIL Opcode = 1
GET FileNum, , Opcode
GET FileNum, , Length
SELECT CASE Opcode
CASE 0
GET FileNum, , Integ
IF Integ < 1028 OR Integ > 1030 THEN ' test this if you want
PRINT "Not a Lotus FIle !"
END
END IF
PRINT "BOF: Lotus ";
SELECT CASE Integ
CASE 1028
PRINT "123 version 1.0 or 1A"
CASE 1029
PRINT "Symphony version 1.0"
CASE 1030
PRINT "123 version 2.0, 2.1 or Symphony version 1.1"
END SELECT
CASE 12 'Blank - Notee: Lotus saves cells only
'if they are formatted or protected
GetFormat Format, Row, Column
PRINT "Blank: "; Format, "Row ="; Row, "Col ="; Column
CASE 13 'Integer
GetFormat Format, Row, Column
GET FileNum, , Integ
PRINT "Integer:"; Format, "Row ="; Row, "Col ="; Column
CASE 14 'Real number (BASIC double precision type)
GetFormat Format, Row, Column
GET FileNum, , Number#
PRINT "Number: "; Format, "Row ="; Row, "Col ="; Column, Number#
CASE 15 'Label
GetFormat Format, Row, Column 'Create a string to hold the label
Info$ = SPACE$(Length - 6)
'6 is subtracted to exclude the
' Format, Column, Row, and 0 bytes
'that were included in the original
'length byte (already gotten by the
'GetFormat routine)
GET FileNum, , Info$ 'get the label text
GET FileNum, , CellFmt$ 'gobble up the trailing chr$(0) byte
PRINT "Label: "; Format, "Row ="; Row, "Col ="; Column, Info$
CASE 16 'Forumla
GetFormat Format, Row, Column
GET FileNum, , Number#
GET FileNum, , Length
SEEK FileNum, SEEK(FileNum) + Length
PRINT "Formula :"; Format, "Row ="; Row, "Col ="; Column, Number#
CASE ELSE
Dummy$ = SPACE$(Length)
GET FileNum, , Dummy$
PRINT "Opcode: "; Opcode 'Show its opcode just for fun
END SELECT
IF CSRLIN > 21 THEN
PRINT : PRINT "Press <Esc> to end or any other key for more . . ."
DO: k$ = INKEY$: LOOP UNTIL LEN(k$)
IF k$ = CHR$(27) THEN EXIT DO
CLS
END IF
Cntr = Cntr + 1
LOOP
PRINT "Number of Records Processed ="; Cntr
CLOSE
SUB GetFormat (Format, Row, Column)
GET FileNum, , CellFmt$: Format = ASC(CellFmt$)
GET FileNum, , Column
GET FileNum, , Row
END SUB