On Mar 11, 2006, at 5:45 AM, Robert Carroll wrote:

Thanks Tom and Joe for your replies.

Just checking the last bit of the existing file would be preferable to reading the entire file. This is eventually going to be a list of registration info for demo users of my application. At the moment its just a few lines for testing, but it will accumulate to a fairly large file.


If you exercise total control ofver the origbinal files creation
though, your best bet is to make sure it goes out with an EndOfLine
character appended to it.


I don't have any problem when the file is only being manipulated by my own realbasic code. Right now, I have a small application that looks through email on my machine, collects the relevant emails, parses out form submission data from them and then write these as lines of tab separated text appended to the existing file.

The problem begins when the resulting file is opened and edited in Excel. The text file opens as a spreadsheet as expected, each line of text as a row on the sheet. Inserting/deleting rows or editing cell contents seems to delete the endofline so that the next attempt to append to the same file often extends the last line, instead of starting a new one.

Would you clarify the entire process a bit? You create the file in Rb using WriteLine, then open the file in Excel. After editing in Excel, what then is done? When you say 'append to the same file' are you back in your app, or are you controlling Excel directly so that you can add to the spreadsheet? How are you doing that?

I'm going to guess a little here so just ignore the following if it doesn't pertain to your process. :-)

If you <are> saving the edited file from Excel then there will be no final line ending unless the Excel user has added one by advancing to the last row plus one. So if you are saving from Excel, bring the entire content of the saved file into your app as a string s using OpenAsTextFile and ReadAll, check for a line ending and add one as required, then add your new data to s with both tabs and line endings and save using CreateTextFile and Write s. This is a fast process and gives you full control.

Best regards,

Jack








_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to