简体   繁体   English

以CSV格式将数据导出到Mail

[英]Exporting Data to Mail in CSV format

I have a list of Expenses Which include date,categoryName and Amount stored in Coredata. 我有一个费用列表,其中包括存储在Coredata中的日期,categoryName和Amount。 I want them to be transferred in CSV Format to Mail.Can this be done?.I also want only the data in the current month to be sent. 我希望它们以CSV格式传输到Mail.Can这可以吗?。我也只想要发送当月的数据。

I googled it and all i found is CHCSV parser and i have no idea on how to use it. 我google了它,我发现的只是CHCSV解析器,我不知道如何使用它。

Converting your data to csv should be easy, just declare a mutable string, iterate over the objects you want to add and add the values you need to the string with comma seperation (best to enclose the data values in "", too). 将数据转换为csv应该很简单,只需声明一个可变字符串,迭代要添加的对象,并使用逗号分隔将所需的值添加到字符串中(最好也将数据值括在“”中)。 You can google on the csv format in wiki. 您可以在wiki上使用csv格式进行谷歌搜索。 Then you write that string to a temp .csv file. 然后将该字符串写入临时.csv文件。 Then, using mfmailcomposer, you attach the .csv-file to the mail and you're done. 然后,使用mfmailcomposer,将.csv文件附加到邮件中,然后就完成了。

If you don't come up with a solution by googling these pieces of information, ask a more specific follow-up question here. 如果您没有通过Google搜索这些信息来提出解决方案,请在此处提出更具体的后续问题。 But there are many resources on mfmailcomposer with examples out there. 但是mfmailcomposer上有很多资源,其中包含一些示例。

Cheers 干杯

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM