Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 104
Default ["\r\n" new line command in CSV file]

[Briefing]
I got an Project export Text into the CSV file type.

However i face a problem that if my CSV data contain multiple line(eg : "
sleep\r\nHello\r\n"), and open this in the CSV file. We notice that a empty
space is appended behind the new line.

[Result]
sleep<Space
Hello<space


If i open this CSV file with notepad, this issue doesnt happen.


[Research]
I had do some similar research

1. Open Outlook contact, at the address field, i break the address into a
few line and export the contact into the CSV file.
- The Outlook CSV file having the same behavior as mention above

2. Open a Notepad and type below text into the notepad.
"CAV

CAV@

CAV@"

and save the notepad into the csv type and then open the CSV file with excel.

- The notepad CSV file also having the same behavior as mention about.


[Question]
why excel appended an empty space behind the "\r\n"? It is a bug for excel?


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default ["\r\n" new line command in CSV file]

Does the CSV file actually contain the sequence of characters

sleep\r\nHello\r\n

or are you just using \n a shorthand in the message to indicate a new
line?

If the file contains the actual character string above, Excel doesn't
recognize \n as a new line indicator and thus then entire character
string will appear in one cell since there is no comma.

Also, do you know what character the Project export procedure uses to
indicate a new line? Is it Chr(10) or Chr(13) or Chr(10)Chr(13) ?

You might have to change the file extension from .csv to .txt and use
the text import wizard to import the file. Or, you can simply write
your own import procedure and deal with line terminators and spaces as
necessary. The code at http://www.cpearson.com/Excel/ImpText.aspx
should give you a starting point.

You might try posting a few lines of the actual data in the exported
file.


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)





On Sun, 16 Aug 2009 23:46:02 -0700, Cathy
wrote:

[Briefing]
I got an Project export Text into the CSV file type.

However i face a problem that if my CSV data contain multiple line(eg : "
sleep\r\nHello\r\n"), and open this in the CSV file. We notice that a empty
space is appended behind the new line.

[Result]
sleep<Space
Hello<space


If i open this CSV file with notepad, this issue doesnt happen.


[Research]
I had do some similar research

1. Open Outlook contact, at the address field, i break the address into a
few line and export the contact into the CSV file.
- The Outlook CSV file having the same behavior as mention above

2. Open a Notepad and type below text into the notepad.
"CAV

CAV@

CAV@"

and save the notepad into the csv type and then open the CSV file with excel.

- The notepad CSV file also having the same behavior as mention about.


[Question]
why excel appended an empty space behind the "\r\n"? It is a bug for excel?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need command line to change "#DIV/0!" into a "0" (zero) mulehead Excel Discussion (Misc queries) 1 May 20th 08 02:09 PM
"FILE" command on the tool bar is missing - how do I recover it Willsecur Excel Discussion (Misc queries) 3 May 16th 07 10:24 PM
How to "Replace()" multiple characters in one VBA command line EagleOne Excel Discussion (Misc queries) 1 April 11th 07 04:12 PM
inserting a conditional "go to" command on a excel "if" function velasques Excel Worksheet Functions 5 March 10th 06 08:16 PM
Removing "Save As" Command from an excel file. Camper Joe Excel Worksheet Functions 0 December 19th 05 03:00 PM


All times are GMT +1. The time now is 04:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"