设置为mimetype的csv文件在电子表格应用程序中打开的设置 [英] What to set as mimetype for csv files to open in spreadsheet applications

查看:1081
本文介绍了设置为mimetype的csv文件在电子表格应用程序中打开的设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序允许用户将其数据下载为csv文件。这些应该在电子表格应用程序中打开。在linux系统上,我得到提示正确打开与OpenOffice。但是我的一些用户抱怨,当他们下载文件,它不会自动打开excel,但要求他们选择的应用程序。当他们从其他网站下载csv时,它在excel中正确打开。

My application lets user download their data as csv files. These are supposed to open in spreadsheet applications. On a linux system, I get prompted correctly to open with OpenOffice. But some of my users complain that when they download the file, it doesnot open automatically excel, but asks them to choose the application. When they download a csv from someother site it opens correctly in excel.

我设置:

mimetype:text / csv

content_disposition:attachment; filename.csv

I am setting:
mimetype: text/csv
content_disposition: attachment; filename.csv

推荐答案

尝试:

Content-Type: text/csv; name="filename.csv"
Content-Disposition: attachment; filename="filename.csv"



在Windows浏览器中,MIME类型在文件下载后被忽略,只有文件扩展名用于确定相应的应用程序。

In Windows browsers the MIME type is ignored after the file is downloaded and only file name extension is used to determine the corresponding application.

此外,使.CSV文件在Excel中正确打开是很难的,因为默认分隔符取自区域设置打开CSV的机器。此外,编码不是从文件内容或MIME类型确定的,因此任何非ASCII字符很难工作。

Also, making .CSV file open in Excel correctly is hard, because the default separator is taken from Regional settings on the machine on which the CSV is opened. Furthermore, the encoding is not determined from the file content or MIME type, so any non-ASCII characters are hard to get working.

这篇关于设置为mimetype的csv文件在电子表格应用程序中打开的设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆