Asp.netÖÐExcelµ¼³ö
¶ÔÓÚasp.net µÄExcelµ¼³ö£¬ÓжàÖÖ·½·¨£¬µ½Ä¿Ç°£¬¸öÈËÈÏΪ£¬ÀûÓÃmyxlsµ¼³öExcel»¹ÊDZȽϺÃÓõģ¬¿ÉÒԺܺõÄÉèÖÃExcelµÄ¸ñʽ¡£¡£¡£
ʹÓúܷ½±ã£¬ÏÂÔØorg.in2bits.MyXls.dll£¬ÒýÈëÃüÃû¿Õ¼ä¼´¿É
ÏÂÃæÊÇÒ»¸öʹÓôúÂëʾÀý£º
private void ExcelExport(IList< LineLossInfo > lossListExcel)
{
XlsDocument xls = new XlsDocument();
xls.FileName = "LineLossMonthDetail.xls";//Ö¸¶¨ÎļþÃû
Worksheet sheet = xls.Workbook.Worksheets.Add("LineLossMonthDetail");
#region ÉèÖø÷Êý¾ÝÁеĴóС
ColumnInfo colInfo1 = new ColumnInfo(xls, sheet);
colInfo1.ColumnIndexStart = 0;
colInfo1.ColumnIndexEnd = 1;
colInfo1.Width = 15 * 256;
sheet.AddColumnInfo(colInfo1);
ColumnInfo colInfo2 = new ColumnInfo(xls, sheet);
colInfo2.ColumnIndexStart = 2;
colInfo2.ColumnIndexEnd = 2;
colInfo2.Width = 15 * 256;
sheet.AddColumnInfo(colInfo2);
ColumnInfo colInfo3 = new ColumnInfo(xls, sheet);
colInfo3.ColumnIndexStart = 3;
colInfo3.ColumnIndexEnd = 3;
colInfo3.Width = 15 * 256;
sheet.AddColumnInfo(colInfo3);
ColumnInfo colInfo4 = new ColumnInfo(xls, sheet);
colInfo4.ColumnIndexStart = 4;
colInfo4.ColumnIndexEnd = 4;
colInfo4.Width = 15 * 256;
sheet.AddColumnInfo(colInfo4);
 
Ïà¹ØÎĵµ£º
Default.aspx CSÎļþ´úÂë
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _De ......
¾Å¡¢ÒÔ±à³Ì·½Ê½Ìí¼Ó ASP.NET ¿Ø¼þ
ÓÐʱ£¬ÔÚÔËÐÐʱ´´½¨¿Ø¼þ±ÈÔÚÉè¼Æʱ´´½¨¿Ø¼þ¸ü¿ÉÐС£ÀýÈ磬¼Ù¶¨ÓÐÒ»¸öËÑË÷½á¹ûÒ³£¬ÄúÒªÔÚÆäÖн«ÒÔ±íµÄÐÎʽÏÔʾ½á¹û¡£ÓÉÓÚ²»ÖªµÀÒª·µ»Ø¶àÉÙÏÒò´ËÄúÐèҪÿ¸ö·µ»ØµÄÏ̬Éú³ÉÒ»¸ö±íÐС£
˵Ã÷£º ÏÖÓпؼþͨ³£¿ÉÒÔÌṩ´Ó¶¯ ......
1.ÎļþÏÂÔØ
HTTP ÎļþÏÂÔØÖ÷ÒªÓÐÁ½ÖÖ·½Ê½£º
URL·½Ê½Ö±½ÓÏÂÔØ£¬ÓŵãÊÇ£ºÕ¼Ó÷þÎñÆ÷×ÊÔ´ÉÙ£¬Ëٶȿ죻ȱµãÊÇ£º ²»ÄÜ׼ȷ¼ÆÁ¿ÏÂÔØ´ÎÊý£¬ÎÞ·¨·ÀÖ¹µÁÁ´£¬±£´æÔÚÊý¾Ý¿âÖеÄÎļþÎÞ·¨ÏÂÔØ£¬³£¼û¸ñʽµÄÎļþÈç.html Ö±½ÓÔÚä¯ÀÀÆ÷Öдò¿ª£¬²»ÄÜÖ±½ÓÏÂÔØ¡£
¶þ½øÖÆÊý¾ÝÁ÷Êä³ö·½Ê½£¬ÓŵãÊÇ£º×¼È·¼ÆÁ¿ÏÂÔØ´ÎÊý¡¢ÄÜ·ÀµÁÁ´¡¢ËùÓÐÎļ ......