简体   繁体   English

如何使Excel将文件另存为文本,并支持Unicode,并支持单元格中的多行(alt输入)?

[英]How to make Excel save a file as text, with support for Unicode, and support for multiple lines within a cell (alt-enter)?

My application needs to pass data back and forth via text files with Excel. 我的应用程序需要使用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)). 我的文本文件将具有Unicode文本,并且还需要某种方式来指示单元格中的多行(我相信这是LF字符(ascii 10))。

Excel can read my csv file correctly. Excel可以正确读取我的csv文件。 However, when I save the csv file in Excel, it replaces the Unicode characters with ?'s. 但是,当我将csv文件保存在Excel中时,它将用?代替Unicode字符。 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. 因此,尽管在Excel中看起来仍然不错,但是如果我关闭Excel并使用Excel重新打开文件,则会看到?而不是我的Unicode字符。

If instead of Excel saving as csv, I save as Unicode text, that produces a tab-delimited file that does have the Unicode characters. 如果不是将Excel另存为csv,而是另存为Unicode文本,则生成一个制表符分隔的文件,该文件确实包含Unicode字符。 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. 但是,如果我关闭文件并用Excel重新打开它,它将带我通过一个导入向导,该向导无法识别LF字符(由alt-enter产生)以指示单元格中的新行。 Instead, it treats the LF as a new row. 相反,它将LF视为新行。

How can I get Excel to save in a text format that supports both Unicode and multiple lines within a cell? 如何使Excel以支持Unicode和一个单元格中多行的文本格式保存?

To get around this problem do not open the .txt file from Excel. 要变通解决此问题,请不要从Excel打开.txt文件。 Instead right click on the file in file explorer and choose open with Excel. 而是右键单击文件资源管理器中的文件,然后选择“使用Excel打开”。

If you save the .txt file with .xls extension you can double click on the file in file explorer to open in Excel. 如果您以.xls扩展名保存.txt文件,则可以双击文件资源管理器中的文件以在Excel中打开。

To Open From Excel 从Excel打开

  • Click File/Open... 单击文件/打开...
  • Select the .txt file to open. 选择.txt文件以打开。
  • Hold down the Shift key when clicking on the Open button. 单击“打开”按钮时,按住Shift键。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 VBA Excel 中用覆盖多个单元格的内容填充剪贴板,这些单元格本身包含换行符 (Alt-Enter)? - Filling the Clipboard with content covering multiple cells which itself are containing line breaks (Alt-Enter) in VBA Excel? 导出到Excel:使用javascript在“单元格中的换行符/ Alt + Enter”中导出文本区域内容 - Export to Excel: export text area contents in single cell “with line break within the cell /Alt + Enter” using javascript 对于 excel 单元(xlsx 文件格式),哪些字符会调用 alt+enter? (wrap_text 不起作用) - What characters invokes alt+enter for an excel cell (xlsx file format)? (wrap_text does NOT work) 导出到Excel文件,单元格换行符,ALT + ENTER - Export to excel file, cell line break, ALT + ENTER Pandas/Excel:调用 DataFrame.to_excel() 时,有什么方法可以将 ALT-ENTER / CHAR(10) 换行符编码为数据? - Pandas/Excel: Any way to encode the ALT-ENTER / CHAR(10) line break into data when calling DataFrame.to_excel()? 模拟alt + enter以在PHP到Excel的单元格CSV输出中创建换行符 - simulate alt+enter to create newline within cell CSV output from PHP to Excel 如何使用apache poi检查excel中的单元格值是否包含alt+enter? - How to check if a cell value in excel contains alt+enter using apache poi? SAS / Excel-展开包含Alt + Enter的单个单元格进入行 - SAS / Excel - Expand Single Cell Containing Alt+Enter into Rows Excel 使用 Alt+Enter“连接”,然后引用另一个单元格 - Excel 'Concatenate' with Alt+Enter, and then reference to another cell Pandas Excel - 如何创建多行文本 ALT+ENTER(无换行文本或 '\n' 字符) - Pandas Excel - How to create multiline text ALT+ENTER (no wrap text or '\n' character)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM