0

我是 Mac 用户,我正在尝试为 iPhone 开发一个应用程序,它可以备份通讯录并通过电子邮件发送。它将数据作为 .csv 文件发送。

当我在 Mac Excel 和 Windows Excel 中打开这个 .csv 文件时,它似乎非常不同。例如,下面显示的代码都会有所不同......

当我这样做时:

[stringToWrite appendFormat:@";"];

在 Windows Excel 中......它显示正常。我的意思是在 Excel 中它是这样显示的;

name  (other cell) phone (other cell) mail
name2 (other cell) phone2(other cell) mail2

但在 Mac Excel 中它看起来像;

name;phone;mail (all in one cell)
name2;phone2;mail2(all in one cell)

当我做这样的代码时;

[stringToWrite appendFormat:@","]; 

在 Mac Excel 中,它显示正常。我的意思是在 Excel 中它是这样显示的;

name  (other cell) phone (other cell) mail
name2 (other cell) phone2(other cell) mail2

但在 Windows Excel 中它看起来像;

name,phone,mail (all in one cell)
name2,phone2,mail2(all in one cell)

任何人都可以帮忙吗?

4

1 回答 1

1

Mac 版和 Windows 版 Excel 的默认分隔符设置不同。(微软的小玩笑),但解决方法是在 Excel 中选择如何导入值。

新建工作表 -> 数据 -> 导入数据,然后选择要使用的分隔符。

我认为您应该考虑您拥有什么样的用户(主要是 Windows 或 Mac)并默认使用。

于 2012-05-02T13:18:31.377 回答