Asp.net GridViewÊý¾Ýµ¼³öµ½Excel£¬Word
Ò»¡¢asp.net DataGridViewµ¼³öµ½ExcelµÄÈý¸ö·½·¨
#region DataGridViewÊý¾ÝÏÔʾµ½Excel
/// <summary>
/// ´ò¿ªExcel²¢½«DataGridView¿Ø¼þÖÐÊý¾Ýµ¼³öµ½Excel
/// </summary>
/// <param name="dgv">DataGridView¶ÔÏó </param>
/// <param name="isShowExcle">ÊÇ·ñÏÔʾExcel½çÃæ </param>
/// <remarks>
/// add com "Microsoft Excel 11.0 Object Library"
/// using Excel=Microsoft.Office.Interop.Excel;
/// </remarks>
/// <returns> </returns>
public bool DataGridviewShowToExcel(DataGridView dgv, bool isShowExcle)
{
if (dgv.Rows.Count == 0)
return false;
//½¨Á¢Excel¶ÔÏó
Excel.Application excel = new Excel.Application();
excel.Application.Workbooks.Add(true);
excel.Visible = isShowExcle;
//Éú³É×Ö¶ÎÃû³Æ
for (int i = 0; i < dgv.ColumnCount; i++)
{
excel.Cells[1, i + 1] = dgv.Columns[i].HeaderText;
}
//Ìî³äÊý¾Ý
for (int i = 0; i < dgv.RowCount - 1; i++)
{
for (int j = 0; j < dgv.ColumnCount; j++)
{
if (dgv[j, i].ValueType == typeof(string))
{
excel.Cells[i + 2, j + 1] = "'" + dgv[j, i].Value.ToString();
}
else
{
excel.Cells[i + 2, j + 1] = dgv[j, i].Value.ToString();
}
}
}
return true;
}
#endregion
#region DateGridViewµ¼³öµ½csv¸ñʽµÄExcel
/// <summary>
/// ³£Ó÷½·¨£¬ÁÐÖ®¼ä¼Ó\t£¬Ò»ÐÐÒ»ÐÐÊä³ö£¬´ËÎļþÆäʵÊÇcsvÎļþ£¬²»¹ýĬÈÏ¿ÉÒÔµ±³ÉExcel´ò¿ª¡£
/// </summary>
/// <remarks>
/// using System.IO;
/// </remarks>
/// <param name="dgv"></param>
private void DataGridViewToExcel(DataGridView dgv)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.Filter = "Execl files (*.xls)|*.xls";
dlg.FilterIndex = 0;
dlg.RestoreDirectory = true;
dlg.CreatePrompt = true;
dlg.Title = "±£´æΪExcelÎļþ";
if (dlg.ShowDialog() == DialogResult.OK)
{
Stream myStream;
myStream = dlg.OpenFile();
StreamWriter sw = new StreamWriter(myStream, Sy
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
public string NoHTML(string Htmlstring) //È¥³ýHTML±ê¼Ç
{
//ɾ³ý½Å±¾
Htmlstring = Regex.Replace(Htmlstring, @" <script[^>]*?>.*? </script>", "", RegexOptions.IgnoreCase);
//ɾ³ýHTML
Htmlstring = Regex.Replace(Htmlstring, @" <(.[^>]*)>", "", RegexOptions.IgnoreCase); ......
CheckBox ¿Ø¼þºÍ CheckBoxList ¿Ø¼þΪÓû§ÌṩÁËÒ»ÖÖÖ¸¶¨ÊÇ/·ñ£¨Õæ/¼Ù£©Ñ¡ÔñµÄ·½·¨¡£
Ò»¡¢¹¦ÄÜ
¿ÉÒÔʹÓà CheckBox ¿Ø¼þºÍ CheckBoxList ¿Ø¼þÖ´ÐÐÒÔϲÙ×÷£º
·µ±Ñ¡ÖÐij¸ö¸´Ñ¡¿òʱ½«ÒýÆðÒ³»Ø·¢¡£
·µ±Óû§Ñ¡ÖÐij¸ö¸´Ñ¡¿òʱ²¶»ñÓû§½»»¥¡£
·½«Ã¿¸ö¸´Ñ¡¿ò°ó¶ ......
ÓÉÓÚÑéÖ¤Âë¼¼ÊõÖзþÎñÆ÷³ÌÐòÐèÒª´´½¨ÑéÖ¤ÂëͼƬ£¬ÀïÃæÓõ½ÁËͼÐαà³Ì£¬Òò´Ë±¾½Ú¿Î³ÌÈÔÈ»ÊÇC#·¢ÏÖÖ®ÂõÄͼÐαà³ÌϵÁн̡̳£
¸ù¾ÝÑéÖ¤ÂëµÄÔÀí£¬ÎÒÃÇʹÓÃC#ÔÚASP.NETÖÐʵÏÖÁËÑéÖ¤ÂëµÄ¹¦ÄÜ¡£
checkimage.aspx
Ê×Ïȸù¾ÝÉϽڿγ̵ÄÄÚÈÝ£¬ÎÒÃÇÒª´´½¨Ò»¸öͼƬ·þÎñҳà ......
[ASP.NET]Log4NetÈ«¹¥ÂÔ
ת×Ô:http://blog.5d.cn/vip/icecream/200511/185284.html
ºÜ¶à¿ª·¢Õ߶¼ÏëÒªÒ»¸ö·Ç³£Ç¿´óµÄ³ÌÐòÈÕÖ¾¹ÜÀí¿â£¬Äܹ»Á˽âÓû§¶ÔÓ¦ÓóÌÐòµÄʹÓÃÇé¿ö¡£µ±³ÌÐò³öÏÖÎÊÌâʱ£¬¿ÉÒÔͨ¹ý·ÖÎöÈÕÖ¾À´Á˽âÎÊÌâÖ®ËùÔÚ¡£
¹ýÈ¥ÎÒÃÇ×ÜÊÇÓÃÒ»Öֺܼòµ¥µÄ·½Ê½À´´¦ÀíÈÕÖ¾£¬¼´£ºÊ¹ÓÃÒ»¸öÈÕÖ¾Îļþ£¬µ±³ÌÐòÓÐÎÊÌâʱ¾ ......