The easiest way to get what Excel wants to get, is creating example data in 
Excel and exporting it as a tab delimited file.

The problematic characters are line wraps, tabs and quotes inside a cell.

The rules:

- field delimiter is tab, record delimiter is CR LF (0x0d 0x0a)

- Tabs inside cells are not allowed in tab delimited format.

- line wraps in cells are encoded as LF (0x0a), the whole cell content is 
enclosed in double quotes (0x22)

- double quotes in cell content are escaped with double double quotes and again 
the cell is wrapped in double quotes



Example:

"first line

second line"    abc tab

do or don't     "some text ""quoted""."



Hex view:

0000000 22 66 69 72 73 74 20 6c 69 6e 65 0a 73 65 63 6f  >"first line.seco<

0000020 6e 64 20 6c 69 6e 65 22 09 61 62 63 20 74 61 62  >nd line".abc tab<

0000040 0d 0a 64 6f 20 6f 72 20 64 6f 6e 27 74 09 22 73  >..do or don't."s<

0000060 6f 6d 65 20 74 65 78 74 20 22 22 71 75 6f 74 65  >ome text ""quote<

0000100 64 22 22 2e 22 0d 0a                             >d""."..<



HTH

Regards Lutz





> -----Original Message-----

> From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Tim Nevels 
> via

> 4D_Tech

> Sent: Wednesday, March 15, 2017 8:39 PM

> To: 4d_tech@lists.4d.com

> Cc: Tim Nevels <timnev...@mac.com>

> Subject: Re: tab seperated text - what to use for Cr

>

> On Mar 15, 2017, at 2:00 PM,Chip Scheide wrote:

>

> > I am trying to export some data to tab separated format.

> > it is possible that there are carriage returns in the data.

> > Is there a character (or combination) that I can use to replace the

> > return to get excel to automatically wrap the text into one cell?

>

> “Space" will work and had no cross-platform macOS/Windows Excel issues. I do 
> this

> whenever

>

> You might also try option-space if you are on macOS. That used to represent a 
> “hard

> space” that some Mac software would recognize and treat like a “soft return”. 
> You

> would have to do some testing to verify how current versions of Excel handle 
> this and

> how it is handled on Windows.

>

> On Windows Excel will handle alt-Enter as a special line break character. But 
> I believe

> this is just a LF — line feed, char(10) — character so it may be problematic 
> since end

> of record delimiters are typically CR+LF.

>

> Tim

>

> ********************************************

> Tim Nevels

> Innovative Solutions

> 785-749-3444

> timnev...@mac.com<mailto:timnev...@mac.com>

> ********************************************

>

> *********************************************************************

> *

> 4D Internet Users Group (4D iNUG)

> FAQ:  http://lists.4d.com/faqnug.html

> Archive:  http://lists.4d.com/archives.html

> Options: http://lists.4d.com/mailman/options/4d_tech

> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com

> *********************************************************************

> *
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to