Sponsored Links
Sponsored Link

sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Line feed in a .csv?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Line feed in a .csv?

    I'm in the middle of writing a program to generate a file. This file will be used to create a document in QDLS, which in turn will be FTPed elsewhere and become a .csv (and be opened using Excel). All of that is built. The issue I'm having is that, for some cells in the eventual Excel, I need a soft line feed character to divide the cell contents into two logical lines.

    I assume I have to insert a control character -- but which one? I've tried \n, Chr(10), and the VB function vbLF all to no avail. Can someone help?

  • #2
    What language are you writing in?

    FYI, QDLS was deprecated many, many, many years ago.

    Comment


    • #3
      I'm writing in RPG, but it doesn't really matter -- I'm writing to a physical, from which I use a CPYTOIMPF to get a document. But that's immaterial to the question.

      Comment


      • #4
        In RPGLE, you can use the hex x'0d25' for a CR/LF character. I'd be concerned that the embedded CR/LF will cause issues with whatever's reading the CSV, but I guess that depends on what the client is.

        Comment


        • jtaylor___
          jtaylor___ commented
          Editing a comment
          Assuming CCSID 37.

      • #5
        I think, with Excel, if you surround the cell content with doublequotes then it will parse the line feed as part of the cell content rather than the end of the CSV line. E.g.:
        Code:
        cell1,cell2,"cell
        3",cell4

        Comment

        sponsored links

        Collapse

        Working...
        X