如何使 Excel 将文件另存为文本,并支持 Unicode,并支持单元格内的多行(alt-enter)?
我的应用程序需要通过文本文件与 Excel 来回传递数据。我的文本文件将包含 Unicode 文本,并且还需要某种方式来指示单元格内的多行(我认为是 LF 字符 (ascii 10))。
Excel 可以正确读取我的 csv 文件。但是,当我在 Excel 中保存 csv 文件时,它会用 ? 替换 Unicode 字符。因此,虽然它在 Excel 中看起来仍然很好,但如果我关闭 Excel 并使用 Excel 重新打开该文件,我会看到 ? 而不是我的 Unicode 字符。
如果我不将 Excel 保存为 csv,而是另存为 Unicode 文本,则会生成一个包含 Unicode 字符的制表符分隔文件。但是,如果我关闭该文件并使用 Excel 重新打开它,它会引导我通过导入向导,该向导无法识别 LF 字符(由 alt-enter 生成)来指示单元格内的新行。相反,它将 LF 视为新行。
如何让 Excel 以支持 Unicode 和单元格内多行的文本格式保存?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要解决此问题,请勿从 Excel 打开 .txt 文件。相反,右键单击文件资源管理器中的文件并选择使用 Excel 打开。
如果您保存扩展名为 .xls 的 .txt 文件,您可以在文件资源管理器中双击该文件以在 Excel 中打开。
从 Excel 打开
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