Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problems with streamwriter output to.csv..........help needed

Problems with streamwriter output to.csv..........help needed

Scheduled Pinned Locked Moved C#
helpsysadmin
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    robustm
    wrote on last edited by
    #1

    Hi, I'm trying to write to a file which shud be .csv. I'm using streamwriter for that as StreamWriter sw = new StreamWriter (Server.MapPath"~/ImportData/Files/"+_FileName),true,Encoding.Unicode); Now the problem is, when i try to open the file in excel does not see the commas in the file and puts all data for that row in the first column. I can resolve this issue by replacing Unicode with Default, but this solve the problem only for culture english. I should definatley go with Unicode, as i have to use this for different cultures. Please, let me know if any ideas, as I'm stuck on this. Thanks robust

    P K 2 Replies Last reply
    0
    • R robustm

      Hi, I'm trying to write to a file which shud be .csv. I'm using streamwriter for that as StreamWriter sw = new StreamWriter (Server.MapPath"~/ImportData/Files/"+_FileName),true,Encoding.Unicode); Now the problem is, when i try to open the file in excel does not see the commas in the file and puts all data for that row in the first column. I can resolve this issue by replacing Unicode with Default, but this solve the problem only for culture english. I should definatley go with Unicode, as i have to use this for different cultures. Please, let me know if any ideas, as I'm stuck on this. Thanks robust

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      wrote:

      let me know if any ideas

      Don't cross post. You asked this same thing yesterday in the General Discussion forum.

      "I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon

      1 Reply Last reply
      0
      • R robustm

        Hi, I'm trying to write to a file which shud be .csv. I'm using streamwriter for that as StreamWriter sw = new StreamWriter (Server.MapPath"~/ImportData/Files/"+_FileName),true,Encoding.Unicode); Now the problem is, when i try to open the file in excel does not see the commas in the file and puts all data for that row in the first column. I can resolve this issue by replacing Unicode with Default, but this solve the problem only for culture english. I should definatley go with Unicode, as i have to use this for different cultures. Please, let me know if any ideas, as I'm stuck on this. Thanks robust

        K Offline
        K Offline
        KaptinKrunch
        wrote on last edited by
        #3

        Have you even looked at the file in notepad to see if the commas are actually there?

        Just because we can; does not mean we should.

        R 1 Reply Last reply
        0
        • K KaptinKrunch

          Have you even looked at the file in notepad to see if the commas are actually there?

          Just because we can; does not mean we should.

          R Offline
          R Offline
          robustm
          wrote on last edited by
          #4

          Yeah, i looked in notepad......its perfect over there........As I said, when i give the encoding as default then it wrks perfect in english culture.... but it is mandatory that it shud also wrk in other cultures such as french and german.....it writes perfectly to the notepad....but when i try to open with excel it screws.....

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups