如何打开ms项目xml文件
当我单击 ASP.Net 中的 xml 文件时,如何立即在 MS Office Project 中打开文件。 现在打开默认的 xml 编辑器。
下载xml文件的代码是
Response.ContentType = "application/vnd.ms-project";
Response.AppendHeader("Content-Disposition", "attachment; filename=file.xml");
UPDATE 我的网页上有一个按钮。当用户单击按钮时,开始下载 xml 格式的 ms 项目文件。 我需要这样做,当用户在浏览器下载对话框中选择“打开文件”时,文件会在 MS Project 中打开
How to immediately open file in MS Office Project when I click a xml file in ASP.Net.
Now open default xml editor.
The code of downloading xml file is
Response.ContentType = "application/vnd.ms-project";
Response.AppendHeader("Content-Disposition", "attachment; filename=file.xml");
UPDATE
There is a button on my web page. When user click on button begins downloading ms project file in xml format.
I need to do that when user choose "open file" in browser download dialog, file opens in MS Project
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过使用指定了
attachment
的Content-Disposition
,您可以告诉浏览器只执行当前正在发生的事情;该文件被视为下载名为file.xml
的文件。如果您不想下载该文件,请尝试完全删除该标头。请注意,仍然不能保证浏览器能够打开 Project,因为它取决于浏览器配置以及用户计算机上安装的内容。
如果您确实希望下载文件,但为了让浏览器在下载后在 Project 中打开它,则需要将
filename
标头值中的文件扩展名更改为 Microsoft Project 的正确文件扩展名。By using
Content-Disposition
withattachment
specified, you are telling the browser to do just what is currently happening; the file is treated like a download of a file calledfile.xml
.If you don't want the file to be downloaded, try removing that header altogether. Note that it is still not guaranteed that the browser will be able to open Project since it depends on browser configuration and what is installed on the user's computer.
If you do want the file downloaded but for the browser to open it in Project after it's downloaded, you need to change the file extension in your
filename
header value to the correct file extension for Microsoft Project.