How to make Excel save a file as text, with suppor

2019-03-06 08:20发布

问题:

My application needs to pass data back and forth via text files with Excel. My text files will have Unicode text, and will also need to have some way of indicating mulitple lines within a cell (which I believe is the LF character (ascii 10)).

Excel can read my csv file correctly. However, when I save the csv file in Excel, it replaces the Unicode characters with ?'s. So although it still looks fine in Excel, if I close Excel and re-open the file with Excel, I see ?'s instead of my Unicode characters.

If instead of Excel saving as csv, I save as Unicode text, that produces a tab-delimited file that does have the Unicode characters. However, if I close the file and re-open it with Excel, it takes me through an import wizard that does not recognize the LF character (produced by alt-enter) to indicate a new line within a cell. Instead, it treats the LF as a new row.

How can I get Excel to save in a text format that supports both Unicode and multiple lines within a cell?

回答1:

To get around this problem do not open the .txt file from Excel. Instead right click on the file in file explorer and choose open with Excel.

If you save the .txt file with .xls extension you can double click on the file in file explorer to open in Excel.

To Open From Excel

  • Click File/Open...
  • Select the .txt file to open.
  • Hold down the Shift key when clicking on the Open button.