开发者

transform an xls to a xml / open xls with c#

开发者 https://www.devze.com 2023-03-08 23:19 出处:网络
I want to n开发者_如何转开发avigate into an Excel .xls file with my c# application. The problem is that I don\'t know how to do it. I tried to open the file with office libraries, etc., but I get a lo

I want to n开发者_如何转开发avigate into an Excel .xls file with my c# application. The problem is that I don't know how to do it. I tried to open the file with office libraries, etc., but I get a lot of problems and I get defeated. Because of that, I was looking into transforming the xls to an xml document with the c# application, but I don't know really well how to do it, or if it is even possible.

I was thinking that probably I have to use the office libraries for this process, and would be the same.

How can I do it more efficiently? I also don't know if I must have Excel installed, is it needed?

Thanks!


You should be able to use EPPlus for this. Its free and open source: http://epplus.codeplex.com/

I've used it for similar problems in the past and its worked great. You do not need Excel installed to use it.


You could connect to the xls file using Microsoft Jet Database engine. You can establish an Oledb

string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                  "Data Source="c:\test.xls;" +
                  "Extended Properties=Excel 8.0;";


This may help you

How do I convert an XLS document to XML in C#?

http://www.codeproject.com/KB/office/excel2xml.aspx

http://www.codeproject.com/KB/office/excelxmlspreadsheet.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消