asp.netµÄcom·½Ê½µ¼³öexcel
×î½ü×ö¸öÏîÄ¿£¬ÐèÒªµ¼³öexcel£¬ÒªÖ÷´Ó±íÒ»Æðµ¼³öµÄ£¬¾Í´óÖÂдÁËÒ»¸ö·½·¨£¬¿ÉÄܸñʽ·½Ã滹ÊÇ»á½øÐÐÐ޸ģ¬ÏÈÌù³öÀ´·½±ãÒÔºó²é¿´
ÏîÄ¿ÒýÓÃ΢ÈíexcelµÄcomµÄdll¼´¿É
/// <summary>
/// ¹¦ÄÜ£ºµ¼³öÎļþ£¨Í¨¹ýÊý¾ÝÔ´µ¼³ö,¿ÉÖ÷´Ó±íµ¼³ö£©
/// </summary>
/// <param name="strTitle">ÎļþÃû×Ö</param>
/// <param name="mainDT">Ö÷±íÊý¾ÝÔ´</param>
/// <param name="dtParams">´Ó±íÊý¾ÝÔ´¼¯ºÏ</param>
public static void Export(string strTitle, System.Data.DataTable mainDT, params System.Data.DataTable[] dtParams)
{
GC.Collect();
Application oApp = new Application();
Workbooks oBooks = oApp.Workbooks;
Workbook oBook = oBooks.Add(true);
Worksheet oSheet = (Worksheet)oBook.ActiveSheet;
int _rowIndex = 4;//ÐÐË÷Òý
int _cellIndex = 1;//ÁÐË÷Òý
int _maxCellIndex = 1;//×î´óÁÐË÷Òý
int _mainRowIndex = 4;//Ö÷±íÐÐË÷Òý
//»æÖƱêÌâ
oSheet.Cells[2, 2] = strTitle;
//»æÖÆÖ÷±íÊý¾Ý
foreach (DataColumn col in mainDT.Columns)
{
_cellIndex++;
//ÉèÖÃÒ»ÐÐÁ½ÁÐ
if (_cellIndex > 17)
{
_rowIndex++;
_cellIndex = 2;
}
oSheet.Cells[_rowIndex, _cellIndex] = col.ColumnName+":";
oSheet.get_Range(oSheet.Cells[_rowIndex, _cellIndex], oSheet.Cells[_rowIndex, _cellIndex + 2]).Select();
oSheet.get_Range(oSheet.Cells[_rowIndex, _cellIndex], oSheet.Cells[_rowIndex, _cellIndex + 2]).HorizontalAlignment = XlHAlign.xlHAlignCenterAcrossSelection;
_cellIndex = _cellIndex + 3;
if (col.DataType == System.Type.GetType("System.DateTime"))// ÈÕÆÚ¸ñʽ
{
oSheet.Cells[_rowIndex, _cellIndex] =Convert.ToDateTime(mainDT.R
Ïà¹ØÎĵµ£º
WebÒ³ÃæÊÇÎÞ״̬µÄ£¬ ·þÎñÆ÷¶Ôÿһ´ÎÇëÇó¶¼ÈÏΪÀ´×Ô²»Í¬Óû§£¬Òò´Ë£¬±äÁ¿µÄ״̬ÔÚÁ¬Ðø¶ÔͬһҳÃæµÄ¶à´ÎÇëÇóÖ®¼ä»òÔÚÒ³ÃæÌøתʱ²»»á±»±£Áô¡£ÔÚÓÃASP.NET Éè¼Æ¿ª·¢Ò»¸öWebϵͳʱ£¬ Óöµ½Ò»¸öÖØÒªµÄÎÊÌâÊÇÈçºÎ±£Ö¤Êý¾ÝÔÚÒ³Ãæ¼ä½øÐÐÕýÈ·¡¢°²È«ºÍ¸ßЧµØ´«ËÍ£¬Asp.net ÌṩÁË״̬¹ÜÀíµÈ¶àÖÖ¼¼ÊõÀ´½â¾ö±£´æºÍ´« ......
ASP.Net ѧϰ֮·µ»ØÉÏÒ»Ò³µÄʵÏÖ·½·¨
[ÈÕÆÚ£º01-20] [×ÖÌ壺´ó ÖРС]
·µ»ØÉÏÒ»Ò³µÄÕâ¸ö¶«¶«ÔÚÎÒÃÇ×öÏîÄ¿µÄʱºòÒ»°ãÊÇÓÃÓÚÌîдÍê±íµ¥ºóÈ·ÈϵÄʱºò£¬ÓжÔÔÀ´ÊäÈëµÄÊý¾Ý½øÐÐÐÞ¸ÄʱÓõģ¬»òÕßÊÇÒòΪÍøվΪÁË·½±ãä¯ÀÀÕ߶øÓÐÐÄÌí¼ÓµÄÒ»¸ö¶«¶«£¬Ò»°ãÕâÖÖ¹¦ÄܵÄʵÏÖÔÚASP.netÖж¼ÊÇÓÃÒ»¸öbuttonµÄ¿Ø¼þÀ´ÊµÏֵģ¬ÊµÏֵķ ......
ÐÂÊÖÈçºÎѧϰc#¡¢asp.net¡¢ado.netºÍ.NET
Èç¹ûÄãÒѾÓн϶àµÄÃæÏò¶ÔÏ󿪷¢¾Ñ飬Ìø¹ýÒÔÏÂÕâÁ½²½£º
µÚÒ»²½¡¡ÕÆÎÕÒ»ÃÅ.NETÃæÏò¶ÔÏóÓïÑÔ£¬C££»òVB.NET¡£
ÔÚûϵͳѧ¹ýÒ»ÃÅÃæÏò¶ÔÏó£¨OO£©ÓïÑÔµÄÇ°ÌáÏÂȥѧASP.NET¡£
ASP.NETÊÇÒ»¸öÈ«ÃæÏò¶ÔÏóµÄ¼¼Êõ£¬²»¶®OO£¬ÄǾø¶Ôѧ ......
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;
usi ......