资源简介
Axspreadsheet的例子
代码片段和文件信息
using System;
using System.Data;
using System.Reflection;
using System.IO;
using Microsoft.Office.Core;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
namespace MOAWindows
{
public class ExcelProgress
{
#region Variables
private Excel.Application excelApplication = null;
private Excel.Workbooks excelWorkBooks = null;
private Excel.Workbook excelWorkBook = null;
private Excel.Worksheet excelWorkSheet = null;
private Excel.Range excelRange = null;//Excel Range object多种用途
private Excel.Range excelCopySourceRange = null;//Excel Range object
private int excelActiveWorkSheetIndex; //活动工作表索引
private string excelOpenFileName = ““; //操作Excel的路径
private string excelSaveFileName = ““; //保存Excel的路径
#endregion
#region Properties
public int ActiveSheetIndex
{
get
{
return excelActiveWorkSheetIndex;
}
set
{
excelActiveWorkSheetIndex = value;
}
}
public string OpenFileName
{
get
{
return excelOpenFileName;
}
set
{
excelOpenFileName = value;
}
}
public string SaveFileName
{
get
{
return excelSaveFileName;
}
set
{
excelSaveFileName = value;
}
}
#endregion
///
/// 构造函数;
///
public ExcelProgress()
{
excelApplication = null;//Excel Application object
excelWorkBooks = null;//Workbooks
excelWorkBook = null;//Excel Workbook object
excelWorkSheet = null;//Excel Worksheet object
ActiveSheetIndex = 1; //默认值活动工作簿为第一个;设置活动工作簿请参阅SetActiveWorkSheet()
}
///
/// 以excelOpenFileName为模板新建Excel文件
///
public bool OpenExcelFile()
{
if (excelApplication != null) CloseExcelApplication();
//检查文件是否存在
if (excelOpenFileName == ““)
{
throw new Exception(“请选择文件!“);
}
if (!File.Exists(excelOpenFileName))
{
throw new Exception(excelOpenFileName + “该文件不存在!“);//该异常如何处理,由什么处理????
}
try
{
excelApplication = new Excel.ApplicationClass();
excelWorkBooks = excelApplication.Workbooks;
excelWorkBook = ((Excel.Workbook)excelWorkBooks.Open(excelOpenFileName Missing.Value Missing.Value Missing.Value Missing.Value Missing.Value Missing.Value Missing.Value Missing.Value Missing.Value Missing.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 914 2010-03-16 11:02 MOAWindows\app.config
文件 151552 2010-03-17 11:04 MOAWindows\bin\Debug\AxInterop.OWC11.dll
文件 45056 2010-03-17 11:04 MOAWindows\bin\Debug\AxInterop.SHDocVw.dll
文件 1093632 2010-01-31 19:12 MOAWindows\bin\Debug\Interop.Excel.dll
文件 217088 2010-02-10 13:38 MOAWindows\bin\Debug\Interop.Microsoft.Office.Core.dll
文件 131072 2010-03-17 11:04 MOAWindows\bin\Debug\Interop.SHDocVw.dll
文件 57344 2010-02-24 14:14 MOAWindows\bin\Debug\Interop.VBIDE.dll
文件 135168 2010-03-18 10:38 MOAWindows\bin\Debug\MOAWindows.exe
文件 914 2010-03-16 11:02 MOAWindows\bin\Debug\MOAWindows.exe.config
文件 163328 2010-03-18 10:38 MOAWindows\bin\Debug\MOAWindows.pdb
文件 5632 2005-11-11 22:25 MOAWindows\bin\Debug\MOAWindows.vshost.exe
文件 914 2010-03-16 11:02 MOAWindows\bin\Debug\MOAWindows.vshost.exe.config
文件 1496576 2008-01-09 08:00 MOAWindows\bin\Debug\shdocvw.dll
文件 27732 2010-03-17 17:00 MOAWindows\bin\Debug\temp.xm
目录 0 2010-03-17 17:00 MOAWindows\bin\Debug
....... 13277 2010-03-16 10:18 MOAWindows\bin\Debugtemp.xls
文件 23632 2010-03-16 19:52 MOAWindows\bin\Debugtemp.xm
目录 0 2010-03-16 19:52 MOAWindows\bin
文件 30350 2010-03-15 16:26 MOAWindows\ExcelProgress.cs
文件 3495 2010-03-15 10:58 MOAWindows\Form1.cs
文件 7692 2010-03-15 10:58 MOAWindows\Form1.Designer.cs
文件 5814 2010-03-15 10:58 MOAWindows\Form1.resx
文件 17173 2010-03-18 11:12 MOAWindows\Form2.cs
文件 12245 2010-03-18 09:57 MOAWindows\Form2.Designer.cs
文件 10995 2010-03-18 09:57 MOAWindows\Form2.resx
文件 9844 2010-03-16 11:23 MOAWindows\MOAWindows.csproj
文件 2705 2010-03-08 20:11 MOAWindows\MSExcle.cs
文件 151552 2010-03-17 11:04 MOAWindows\obj\Debug\AxInterop.OWC11.dll
文件 45056 2010-03-17 11:04 MOAWindows\obj\Debug\AxInterop.SHDocVw.dll
文件 409600 2010-03-05 17:17 MOAWindows\obj\Debug\Interop.Microsoft.Office.Core.dll
............此处省略48个文件信息
- 上一篇:openssl-cookbook 中文版
- 下一篇:小区物业管理系统PPT
相关资源
- MT8163规格书资料
- QCA9558官方datasheet
- nvp6134 datasheet and driver
- OV9734 DATASHEET,完整规格书
- CFA_2018_Level_1_Schweser_Quicksheet.pdf
- NT96650 和 NT96660 datasheet
- OTM8009A_datasheet
- AR8328 datasheet
- MAX9286 datasheet
- LC1860C数据手册 LC1860 Datasheet Leadcore
- 28027中文数据手册
- tms320f2812_官方中文手册_datasheet
- MIPS 24KEc Processor Core Datasheet
-
QT st
yleSheet - DM9621-以太网芯片—中文版
- 高通 QCA9531 datasheet
- RTL8762CMF_RTL8752CMF_Datasheet
- ATS2825 Datasheet
- MT031 手册 datasheet
- imx253规格书
- MT7620_ProgrammingGuide(MT7620 datasheet完整
- imx290-302-305-265-285-327-385-sensor手册.ra
- 东芝TC358779XBG-TC358747-TC358749-datasheet+硬
- Exynos4412 数据手册 完整版
- Spread.Sheets-Designer.12.0.0.exe
- 合泰单片机HT32F52352例程数据手册.zi
- mid文件解析成曲谱
- STM32 中文手册 Datasheet
- ICM-20948 官方全部资料 .zip
- ATmega单片机中文数据手册ATmega8-16-32
评论
共有 条评论