Please! this is driving me nuts (beginner)
How do i use the text content of a cell ("D:\Capex.xls") on a spreadsheet (sheet1) instead of having many pieces of code.
If the following text "D:\Capex.xls" is in a cell on a spreadsheet how should I write code that will open this file? Please help as i have not seen code on this topic or is my thinking "weird"
Open Filename:="D:\Capex.xls"
[363 byte] By [
Cassie] at [2007-11-11 8:18:18]

# 1 Re: Please! this is driving me nuts (beginner)
i dont really understand what u mean.....
so do u want to open the file? and like read the lines in it (for .txt)?
or does it not open
in java, file names cant have "\n" or "\t" or almost anything with a "\"
so u ahve to write "\\" instead of "\"
e.g. D:\\Test\\test.txt
if u need help opening it then try this:
FileReader fr = null;
BufferedReader br = null;
try
{
fr = new FileReader("D:\\Test\\Test.txt");
br = new BufferedReader(fr);
while ( br.ready() ) // chains
{
String str = br.readLine();
String before = jTextArea1.getText();
jTextArea1.setText(before + str + "\n");
}
} // try
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
try {
br.close();
fr.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
sorry for its weird size =p
this is some code from an app i made
hope i helped =\