XML使用Windows XP和C#.NET的Excel(2007)思路 [英] XML to Excel (2007) Ideas using Windows XP, and C#.Net

查看:115
本文介绍了XML使用Windows XP和C#.NET的Excel(2007)思路的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我已经修改到XML文档,然后使用XSL表转换到Excel XML格式,以便允许编程开通了我的应用程序中的数据的数据集。我遇到了两个问题:

  1. Excel不是默认的Windows应用程序打开Excel文件,因此当Program.Start(xmlfilename.xml)运行时,IE浏览器打开和XML文件是不是很可读。

  2. 如果您重命名为原来的.xlsx文件,您会收到警告,这不是一个Excel文件,你是否想继续。这是不理想的客户。

在理想情况下,我希望Windows在Excel中打开该文件,而无需修改默认的操作系统设置在打开Excel文件。办公室互操作是可能的,但似乎有点矫枉过正了这个应用程序。没有人有任何的想法,使这项工作?

解决的办法是在.net / C#中,但我开到其他的可能性,创造一个干净的解决方案。

解决方案

 的Process.Start(@C:\ Program Files文件\微软的Office \ Officexx \ EXCEL.EXE,yourfile的.xml);
 

话虽这么说,您仍将得到的消息框。我想,你可以使用互操作的,但我不知道它如何会为你工作。

I have a dataset that I have modified into an xml document and then used a xsl sheet to transform into an Excel xml format in order to allow the data to be opened programatically from my application. I have run into two problems with this:

  1. Excel is not the default Windows application to open Excel files, therefore when Program.Start("xmlfilename.xml") is run, IE is opened and the XML file is not very readable.

  2. If you rename the file to .xlsx, you receive a warning, "This is not an excel file, do you wish to continue". This is not ideal for customers.

Ideally, I would like Windows to open the file in Excel without modifying the default OS setting for opening Excel files. Office interop is a possibility, but seems like a little overkill for this application. Does anyone have any ideas to make this work?

The solution is in .Net/C#, but I am open to other possibilities to create a clean solution.

解决方案

Process.Start(@"C:\Program Files\Microsoft Office\Officexx\excel.exe", "yourfile.xml");

That being said, you will still get the message box. I suppose that you could use the Interop, but I am not sure how well it will work for you.

这篇关于XML使用Windows XP和C#.NET的Excel(2007)思路的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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