没有合适的资源?快使用搜索试试~ 我知道了~
非常好的例子,C#操作excel,用了俩控件:菜单和打开文件对话框。 三个菜单如下:
资源推荐
资源详情
资源评论
C#操作 excel 实例
用 c#操作 excel 进行成绩统计:
用了俩控件:菜单和打开文件对话框。
三个菜单如下:
程序如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using Excel;
using System.Runtime.InteropServices;
using System.IO;
namespace excel 操作
{
public partial class excel 操作 : Form
{
Excel.Application oXL;//定义变量
Excel.Workbook oWB;
Excel.Worksheet oST;
Excel.Range dyg;
string path = null;
string[] xx = new string[8] { "南村 1", "南村 2", "兴
中", "东风", "尧场", "峪头", "普乐塬", "西沟" };
string[] kmb = new string[3] { "语文", "数学", "英语"
};
string[] nj = new string[6] { "一年级", "二年级", "三
年级", "四年级", "五年级", "六年级" };
int[,] gbrs = new int[6,8] {
{ 31, 31, 23, 28, 13, 17, 10, 10 },
{ 35, 35, 36, 22, 21, 19, 17, 12 },
{ 36, 36, 45, 39, 17, 0, 0, 0 },
{ 41, 41, 38, 42, 21, 0, 0, 0 },
{ 39, 39, 39, 49, 17, 0, 0, 0 },
{ 42, 42, 43, 54, 14, 0, 0, 0 }};
int[,] hgrs = new int[6, 8];
public excel 操作()
{
InitializeComponent();
}
public struct banji
{
public double xkrs; //学科人数
public double xkzf; //学科总分
public double xkjgr; //学科及格人数
public double xkyxr; //学科优秀人数
public double xkjunf; //学科均分
public double xkjf; //学科积分
}
class xk //构造函数 xk(),运来计算学科均分和
积分
{
double rs;
double zf;
double jgr;
double yxr;
public xk(double x,double y,double z,double w)
{
rs = x;
zf = y;
jgr =z;
yxr =w;
}
public double junf()
{
return zf / rs;
}
public double jf()
{
return zf / rs * .6 + jgr / rs * 25 + yxr / rs * 15;
}
}
public static banji[,,] bj = new banji[6,8,3]; //全局变
量
private void 建表()
{
oXL = new Excel.Application(); //创建 EXCEL 对
象
oWB = oXL.Workbooks.Add(true);
oXL.Visible = true;
}
剩余63页未读,继续阅读
资源评论
- ganfeng09162014-10-21一般,有帮助,可惜是文档,不是源程序
暗影骑士
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功