2014年9月24日

摘要: public void ExportToExcel() { DataTable dt = getDataTable(); if (dt == null) { MessageBox.Show("没有数据可供导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon 阅读全文

posted @ 2014-09-24 19:19 且行且歌 阅读(1205) 评论(0) 推荐(0) 编辑

摘要: 1、引用Microsoft.Office.Interop.Excel.dll 2、引用命名空间、使用别名 [csharp] view plaincopy using System.Reflection; using Excel = Microsoft.Office.Interop.Excel; [c 阅读全文

posted @ 2014-09-24 18:04 且行且歌 阅读(1227) 评论(0) 推荐(0) 编辑

摘要: 1.新建一个项目 2.给项目添加引用:Microsoft Excel 12.0 Object Library (2007版本) 3.对excel的简单操作:如下代码“添加超链接”等。 参考: http://support.microsoft.com/kb/302084/zh-cn http://ww 阅读全文

posted @ 2014-09-24 17:38 且行且歌 阅读(267) 评论(0) 推荐(0) 编辑

摘要: 操作当前单元格(关键代码就两行) Range range = (Range)ExSheet.Cells[i + 2, j + 1]; //要添加的单元格位置sheet.Hyperlinks.Add(range, "http://blog.sina.com.cn/u/2086403861", Miss 阅读全文

posted @ 2014-09-24 17:20 且行且歌 阅读(224) 评论(0) 推荐(0) 编辑

摘要: 事件处理概述 Visual C# .NET 使用委派处理来自组件对象模型 (COM) 服务器的事件。委派是 Microsoft Visual Studio .NET 中的一个新概念。对于 COM 事件,委派是一种特殊对象,它侦听来自 COM 服务器的事件,然后将其转发给 Visual C# 函数。要 阅读全文

posted @ 2014-09-24 09:10 且行且歌 阅读(998) 评论(0) 推荐(0) 编辑

摘要: //这里加添加一个Excel对象的包装器。就是添加一个引用 using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; n 阅读全文

posted @ 2014-09-24 08:50 且行且歌 阅读(631) 评论(0) 推荐(0) 编辑

摘要: 1 增加应用 Microsoft.Office.Interop.Excel 2 引用命名空间 using Excel = Microsoft.Office.Interop.Excel; /// <summary> /// If the supplied excel File does not exi 阅读全文

posted @ 2014-09-24 08:47 且行且歌 阅读(1276) 评论(0) 推荐(0) 编辑


Copyright © 2024 且行且歌
Powered by .NET 8.0 on Kubernetes