Txt File Symbol problem C# or Excel

Txt File Symbol problem C# or Excel

k005
Advisor Advisor
820 Views
5 Replies
Message 1 of 6

Txt File Symbol problem C# or Excel

k005
Advisor
Advisor

 

Hello.,

I am creating a .txt file from AutoCAD with this code.

There is no problem when I open the .txt file with Notepad. But when I import it into Excel, the symbol ø = looks like this = ø

Where can this come from?

Thanks.

 

 

 

        private void button1_Click(object sender, EventArgs e)
        {

            string sPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)+ @"\Donatilar.txt";
            string s1="";
            foreach (object item in listBox1.Items) s1 += item.ToString() + "\n";
            Clipboard.SetText(s1);
            
            //Encoding.GetEncoding("iso-8859-9")

           

            System.IO.StreamWriter SaveFile = new System.IO.StreamWriter(sPath);
            foreach (var item in listBox1.Items)
            {
                SaveFile.WriteLine(item);
            }

            SaveFile.Close();

           MessageBox.Show(sPath + "  oluşturuldu !");

         
        }

 

 

0 Likes
Accepted solutions (1)
821 Views
5 Replies
Replies (5)
Message 2 of 6

essam-salah
Collaborator
Collaborator

 @k005 

so when you copy/paste from *.txt to excel the symbol changes, would you give a sample *.txt file , because  i just copy/paste-ed from.txt to excel and it works fine

Message 3 of 6

k005
Advisor
Advisor

@essam-salah 

 

 

I'm adding the file.

There is no problem when I copy / Paste.

But I am importing in .txt file to Excel. The problem is in this case ..

 
 
 

Now let me try on Another Computer ... Will the same problem continue ...

Thanks.

 
0 Likes
Message 4 of 6

essam-salah
Collaborator
Collaborator

hi @k005 

man idk what is your problem, i just imported the file you attached to excel and it works fine,

watch the attached video.

0 Likes
Message 5 of 6

k005
Advisor
Advisor

@essam-salah 

 

Yes, that's okay. But I use an Excel macro. there is the problem ...

The file is attached.

 

 

0 Likes
Message 6 of 6

k005
Advisor
Advisor
Accepted solution

@essam-salah 

 

I found the solution.

 

Thank you.

 

 

 System.IO.StreamWriter SaveFile = new System.IO.StreamWriter(sPath, false, Encoding.Default);