sub failistLugemine open "c:\temp\test.txt" for Input as #1 Line input #1, rida msgbox rida close #1 end sub sub failiKirjutus open "c:\temp\test.txt" for output as #1 print #1, "Tere" print #1, "Esimene kirjutuskatsetus" close #1 end sub sub ruudud open "c:\temp\test.txt" for output as #1 nr=1 while nr<=20 print #1, nr, nr*nr nr=nr+1 wend close #1 end sub sub nimedLeheltFaili open "c:\temp\test.txt" for output as #1 leht=StarDesktop.CurrentComponent.sheets(0) reanr=0 while len(leht.getCellByPosition(0, _ reanr).String)>0 print #1, leht.getCellByPosition(0, _ reanr).String reanr=reanr+1 wend end sub sub nimedLeheltHTMLFaili open "c:\temp\test.html" for output as #1 print #1, "" print #1, " " print #1, " Inimeste nimekiri" print #1, " " print #1, " " print #1, " " print #1, " " print #1, "" end sub sub nimedLeheltHTMLTabelisse open "c:\temp\test.html" for output as #1 print #1, "" print #1, " " print #1, " Inimeste nimekiri" print #1, " " print #1, " " print #1, " " leht=StarDesktop.CurrentComponent.sheets(0) reanr=0 while len(leht.getCellByPosition(0, reanr).String)>0 print #1, " " reanr=reanr+1 wend print #1, "
" & _ leht.getCellByPosition(0, _ reanr).String & "" & _ leht.getCellByPosition(1, _ reanr).String & "
" print #1, " " print #1, "" end sub sub nimedeLugemine open "c:\temp\nimed.txt" for input as #1 leht=StarDesktop.CurrentComponent.sheets(0) reanr=0 while not eof(1) Line input #1, rida msgbox rida leht.getCellByPosition(5, reanr).string=rida reanr=reanr+1 wend close #1 end sub sub nimedeJaAastad open "c:\temp\nimed.txt" for input as #1 leht=StarDesktop.CurrentComponent.sheets(0) reanr=0 while not eof(1) Line input #1, rida msgbox rida tyhikukoht=instr(rida, " ") eesnimi=mid(rida, 1, tyhikukoht) aasta=mid(rida, tyhikukoht) leht.getCellByPosition(5, reanr).string=eesnimi leht.getCellByPosition(6, reanr).string=aasta reanr=reanr+1 wend close #1 end sub