Line Breaks added to text file

Status
Not open for further replies.
Hello, recently upgraded to outlook 2010. I receive log files from a firewall on a regular basis and I have code that loads these to a database. Unfortunately, Outlook 2010 is adding Cr LF after so many characters - Ascii 13 and Ascii 10, but that messes up the code as each logfile entry should be on one line. Is there a setting somewhere to turn this off? I never had this issue in 2003. Also - I never actually read the files. A rule dumps them to a folder, and the program i run pulls them to text file.
I've seen that others are having this problem - but haven't seen an answer yet.

Thanks

Willie
 

catherized

Senior Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server 2010
Are the logs sent in the message body or as attachments? If in the message body, the option to remove line breaks could be affecting it. You can disable that option in File, options. AFAIK, it does not affect attachments (and should not).
 
You know, at first glance, that does appear to fix it. The firewall log is in the body text. I was just thinking - that couldnt be it because it's adding linebreaks, not taking them out. But when I copy and paste after changing the setting, everything lines up one entry per line as it should. Thanks for the tip!
 

larry

Senior Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
Technically, its removing line breaks - that is the default setting. It's removing them so the lines wrap - and by disabling it, you keep the original breaks.
 
Ok, when i exported to text, i still got the extra line breaks. This was the offending code:

oMsg.SaveAs(sFilename, Microsoft.Office.Interop.Outlook.OlSaveAsType.olTXT)

but, when i switched to the code below, no extra line breaks

My.Computer.FileSystem.WriteAllText(sFilename, oMsg.Body.ToString, False)

So looks like the SaveAs function is the source of the problem. Perhaps because its set to save as Unicode??? Me knoweth not - but this fixed it.
 

catherized

Senior Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server 2010
Thanks for letting us know the solution. It's possible its related to saving as unicode but since its adding a LF, i think its something goofy with outlook.
 
Status
Not open for further replies.
Top