我们如何通过c#Windows程序访问excel文件 [英] how can we access a excel file throgh a c# Windows program

查看:55
本文介绍了我们如何通过c#Windows程序访问excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过c#Windows程序访问excel文件

how can we access a excel file throgh a c# Windows program

推荐答案

1。 阅读 - excel-from-csharp [ ^ ]

2. 写作到Excel的使用,CSHARP [< a href =http://social.msdn.microsoft.com/Forums/vstudio/en-US/ef11a193-54f3-407b-9374-9f5770fd9fd7/writing-to-excel-using-c?forum=csharpgeneraltarget = _blanktitle =新窗口> ^ ]
1. reading-excel-from-csharp[^]
2. writing-to-excel-using-csharp[^]


您需要使用COM Interop来使用Excel,首先需要安装Excel或Office。现在糟糕了,使用不同版本的Office,保持一切顺序可能是相当艰巨的。有些版本的Office以不同方式实现某些方法,或者不支持其他版本的功能。您的代码需要在plcace中进行检查,以防止尝试执行特定版本不支持的操作或发生崩溃。



警告到位后,这里是一个可以帮助你入门的教程。

如何:使用COM Interop创建Excel电子表格(C#编程指南) [ ^ ]
You will need to use the COM Interop to work with Excel, 1st you need to have Excel or Office installed. Now the bad, with the different versions of Office it can be quite daunting to keep it all in order. There are versions of Office that implement some methods differently or do not support features that other versions do. Your code will need to have checks in plcace to prevent trying to do something that a certain version does not support or crashes will happen.

With warning in place, here is a tutorial that will get you started.
How to: Use COM Interop to Create an Excel Spreadsheet (C# Programming Guide)[^]


这篇关于我们如何通过c#Windows程序访问excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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