Help!:
I use javascript to format repetitive data from a web page input FORM
into a long string , and save it as lines of comma delimited data in a
text file on a Unix server. The text file is meant to be downloaded
to MS Excel on the users' computers. Several such files will be
downloaded and appended into the Excel file. Problem: The text file
looks good when viewed offline by any text reader, but Excel will not
import it without problems with the lines.
Sample data, stored as one string:
Blue Angelfish,Holac anthus bermdensis,n/a,1,PC,1900,n/a,4/3/2004,Palm
Beach,2645.702, 8001.279,80,60, 1,40,40,yes,Cro ss Current Barge
French Angelfish,Pomac anthus paru,n/a,2,PC,1900,n/a,4/3/2004,Palm
Beach,2645.702, 8001.279,80,60, 1,40,40,yes,Cro ss Current Barge
etc. for approximately 40 more lines.
MS EXCEL will import the data into the correct columns, but each row
(line) will be followed by a blank row, then another row of data
then another blank row. Additionally, while in this funk of blank
lines, Excel won't allow a 2nd text similar file to be imported.
The problem appears to be linefeeds. The long data string above is
broken into seperate lines of output text in the javascript by use of
the special character "\n". The server seems to handle this
successfully, as the output file looks like neat lines of text, with
commas between the data entries. However, in fact, the last ascii
character in each line is followed by a single blank whitespace (the
linefeed?). EXCEL for some reason makes this into an entire new row,
completely blank, and stops further importing of additional text files.
I've asked the Excel Forums what to do and they say "just fix the text",
so I'm back to javascript for ideas. I can't change the server's
habits, so I back to the javascript.
I've also tried the special javascript character "\r" when formatting
the linebreaks, and even tried the windows linefeed of "\r\n", all to
no avail. The serverformats the text into seperate lines (rows) with
a blank whitespace at the end of each line, and EXCEL for some reason
makes this into an entire blank row. I can't use the escape function
on the special characters, since escape also affects the white spaces,
commas, apostrophes, etc, and besides, Excel cannot UnEscape them.
This linefeed on Unix/Windows must be a common problem. Just point me
toward the solution.
Wade
I use javascript to format repetitive data from a web page input FORM
into a long string , and save it as lines of comma delimited data in a
text file on a Unix server. The text file is meant to be downloaded
to MS Excel on the users' computers. Several such files will be
downloaded and appended into the Excel file. Problem: The text file
looks good when viewed offline by any text reader, but Excel will not
import it without problems with the lines.
Sample data, stored as one string:
Blue Angelfish,Holac anthus bermdensis,n/a,1,PC,1900,n/a,4/3/2004,Palm
Beach,2645.702, 8001.279,80,60, 1,40,40,yes,Cro ss Current Barge
French Angelfish,Pomac anthus paru,n/a,2,PC,1900,n/a,4/3/2004,Palm
Beach,2645.702, 8001.279,80,60, 1,40,40,yes,Cro ss Current Barge
etc. for approximately 40 more lines.
MS EXCEL will import the data into the correct columns, but each row
(line) will be followed by a blank row, then another row of data
then another blank row. Additionally, while in this funk of blank
lines, Excel won't allow a 2nd text similar file to be imported.
The problem appears to be linefeeds. The long data string above is
broken into seperate lines of output text in the javascript by use of
the special character "\n". The server seems to handle this
successfully, as the output file looks like neat lines of text, with
commas between the data entries. However, in fact, the last ascii
character in each line is followed by a single blank whitespace (the
linefeed?). EXCEL for some reason makes this into an entire new row,
completely blank, and stops further importing of additional text files.
I've asked the Excel Forums what to do and they say "just fix the text",
so I'm back to javascript for ideas. I can't change the server's
habits, so I back to the javascript.
I've also tried the special javascript character "\r" when formatting
the linebreaks, and even tried the windows linefeed of "\r\n", all to
no avail. The serverformats the text into seperate lines (rows) with
a blank whitespace at the end of each line, and EXCEL for some reason
makes this into an entire blank row. I can't use the escape function
on the special characters, since escape also affects the white spaces,
commas, apostrophes, etc, and besides, Excel cannot UnEscape them.
This linefeed on Unix/Windows must be a common problem. Just point me
toward the solution.
Wade
Comment