易截截图软件、单文件、免安装、纯绿色、仅160KB

asp.net合并excel

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb; //导入命名空间
using System.IO;
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;
using System.Data;
using EnterExcel.BLL;
using EnterExcel.Models;
public partial class JoinExcel : System.Web.UI.Page
{
 protected void Page_Load(object sender, EventArgs e)
 {
  if (!IsPostBack) { }
 }
 private static List<string> listFiles = new List<string>();
 List<Pencil> pencilList = new List<Pencil>();
 //“将Excel添加到集合中”事件
 protected void btnAdd_Click(object sender, EventArgs e)
 {
  listFiles.Add(this.fuSearchExcel.PostedFile.FileName);
 }
 //“导入Excel到界面”事件
 protected void btnJoinExcel_Click(object sender, EventArgs e)
 {
  //遍历集合
  foreach (string listFile in listFiles)
  {
   //将Excel路径循环赋给方法
   DataTable dt = CreateDataSource(listFile);
   foreach (DataRow row in dt.Rows)
   {
    Pencil pencil = new Pencil();
    pencil.Name = row[0].ToString();
    pencil.Type = row[1].ToString();
    pencil.Number = row[2].ToString();
    pencil.Unit = row[3].ToString();
    pencilList.Add(pencil);
   }
  }
  this.gvInfo.DataSource = LoadExcelFiles(pencilList);
  this.gvInfo.DataBind();
  listFiles.Clear();
 }
 List<Pencil> list = new List<Pencil>();
 public List<Pencil> LoadExcelFiles(List<Pencil> pencilList)
 {
  Pencil p = null;
  for (int i = 0; i < pencilList.Count; i++)


相关文档:

asp.net 等比例生成上传图片的高质量缩略图的方法

方法1
HttpFileCollection files   = HttpContext.Current.Request.Files;
//我设置的大小不超过A4纸的缩略图
int newWidth=620;
int newHeight=880;
System.Drawing.Image img = null;
            
for(int iFile = 0; iFile < files.C ......

asp.net 取得用户控件里的属性或控件

最近在用用户控件时,引用户控件的页面有时候会和用户控件进行数据的交互,网上好像很多人不知道何获取
写个例子说明一下
 
取得用户控件里面的控件并进行赋值
用户控件aspx页代码
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="HeadPanel.ascx.cs" Inherits="HeadPanel" %>
  & ......

asp.net导出Excel时 数字转换文本的问题

页面导出Excel时,常用的直接RenderControl的方法,如果表格中有数字,在Excel中往往格式会乱,比如前面有0,但显示出来后0都被去掉了。
因此要在绑定数字的时候,手动指定一下此列的格式,让数字以文本方式显示就行了
 protected void myGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
......

[翻译]ASP.NET MVC

在今天,MVC(Model-View-Controller)设计模式与测试驱动开发方法(Test-Driven Development 简称TDD)被广泛应用于企业级WEB应用的开发中。MVC设计模式强制我们将应用分解成三个部分:模型(Model)负责业务数据的存储及管理,视图(View)负责呈现数据,并为用户提供与系统交互的界面接口,而控制器(Controller)则负责将用户动作 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号