資源簡(jiǎn)介
C# 倉(cāng)庫(kù)管理系統(tǒng)

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.Data.SqlClient;
namespace?cangku
{
???class?daochuEXCEL
????{
????????public??static??void?ExportExcel(string?fileName?DataGridView?myDGV)
????????//導(dǎo)出函數(shù)有兩個(gè)參數(shù),一個(gè)為保存文件名,另一個(gè)為當(dāng)前顯示數(shù)據(jù)的datagridview
????????{
????????????string?saveFileName?=?““;
????????????SaveFileDialog?saveDialog?=?new?SaveFileDialog();//建立保存對(duì)話框
????????????saveDialog.DefaultExt?=?“xls“;
????????????saveDialog.Filter?=?“Excel文件|*.xls“;
????????????saveDialog.FileName?=?fileName;
????????????saveDialog.ShowDialog();
????????????saveFileName?=?saveDialog.FileName;
????????????if?(saveFileName.IndexOf(“:“)?0)?return;?//被點(diǎn)了取消?
????????????Microsoft.Office.Interop.Excel.Application?xlApp
?????????=?new?Microsoft.Office.Interop.Excel.Application();
????????????if?(xlApp?==?null)
????????????{
????????????????MessageBox.Show(“無(wú)法創(chuàng)建Excel對(duì)象,可能您的機(jī)子未安裝Excel“);
????????????????return;
????????????}
????????????Microsoft.Office.Interop.Excel.Workbooks?workbooks?=?xlApp.Workbooks;
????????????Microsoft.Office.Interop.Excel.Workbook?workbook?=?workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
????????????Microsoft.Office.Interop.Excel.Worksheet?worksheet?=?(Microsoft.Office.Interop.Excel.Worksheet)workbook.Worksheets[1];//取得sheet1?
????????????//寫(xiě)入標(biāo)題,headertext為標(biāo)題屬性
????????????for?(int?i?=?0;?i?????????????{?worksheet.Cells[2?i?+?1]?=?myDGV.Columns[i].HeaderText;?}
????????????//寫(xiě)入數(shù)值
????????????worksheet.Cells[1?1]?=?fileName;
????????????//寫(xiě)入導(dǎo)出數(shù)據(jù)的表格名稱
????????????for?(int?r?=?0;?r?????????????{
????????????????for?(int?i?=?0;?i?????????????????{
????????????????????worksheet.Cells[r?+?3?i?+?1]?=?myDGV.Rows[r].Cells[i].Value;
????????????????}
????????????????System.Windows.Forms.Application.DoEvents();
????????????}
????????????worksheet.Cells[myDGV.Rows.Count?+?4?2]?=?“導(dǎo)出數(shù)據(jù)時(shí)間:“;//顯示導(dǎo)出時(shí)間???
????????????worksheet.Cells[myDGV.Rows.Count?+?4?3]?=?Convert.ToString(DateTime.Now);
????????????worksheet.Columns.EntireColumn.AutoFit();//列寬自適應(yīng)
????????????if?(saveFileName?!=?““)
????????????{
????????????????try
????????????????{?workbook.Saved?=?true;?workbook.SaveCopyAs(saveFileName);?}
????????????????catch?(Exception?ex)
????????????????{
????????????????????MessageBox.Show(“導(dǎo)出文件時(shí)出錯(cuò)文件可能正被打開(kāi)!\n“?+?ex.Message);
????????????????}
????????????}
????????????xlApp.Quit();
????????????MessageBox.Show(fileName?+?“的簡(jiǎn)明資料保存成功“?“提示“?MessageBoxButtons.OK);
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????34304??2010-11-16?20:25??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\劉振明?論文\1--20063262l劉振明審批表.doc
?????文件??????52736??2010-11-16?20:25??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\劉振明?論文\2--20063262劉振明任務(wù)書(shū).doc
?????文件??????43008??2010-11-16?20:25??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\劉振明?論文\3--20063262劉振明開(kāi)題報(bào)告.doc
?????文件??????24576??2010-11-16?20:25??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\劉振明?論文\4--摘要.doc
????..A.SH.???????162??2010-11-16?20:25??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\劉振明?論文\~$3.5.doc
?????文件?????143872??2010-11-16?20:25??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\劉振明?論文\劉振明.ppt
?????文件????1326592??2010-11-16?20:25??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\劉振明?論文\正文.doc
?????文件????????667??2013-05-14?19:53??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\app.config
?????文件????2886144??2013-05-14?21:02??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\cangku.exe
?????文件????????667??2013-05-14?19:53??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\cangku.exe.config
?????文件?????556544??2013-05-14?21:02??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\cangku.pdb
?????文件??????14328??2013-05-14?21:04??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\cangku.vshost.exe
?????文件????????667??2013-05-14?19:53??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\cangku.vshost.exe.config
?????文件????????490??2009-06-11?05:14??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\cangku.vshost.exe.manifest
?????文件?????217088??2013-05-14?19:47??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\Interop.Microsoft.Office.Core.dll
?????文件????1048576??2010-11-16?20:25??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\Microsoft.Office.Interop.Excel.dll
?????文件????2031616??2013-05-14?21:02??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\WMS_DATA.MDF
?????文件?????516096??2013-05-14?21:02??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\WMS_DATA_log.ldf
?????文件????8585216??2013-05-14?19:52??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\bin\Debug\WMS_LOG.LDF
?????文件??????14009??2013-05-14?19:53??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\cangku.csproj
?????文件????????486??2013-05-14?19:53??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\cangku.csproj.user
?????文件???????2973??2010-11-16?20:24??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\daochuEXCEL.cs
?????文件????????411??2010-12-13?10:54??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\dbhelper.cs
?????文件???????1922??2010-11-16?20:24??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\goodsadd.cs
?????文件??????12276??2010-11-16?20:24??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\goodsadd.Designer.cs
?????文件???????5814??2010-11-16?20:24??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\goodsadd.resx
?????文件???????2163??2010-11-16?20:24??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\goodsManage.cs
?????文件???????7861??2010-11-16?20:24??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\goodsManage.Designer.cs
?????文件???????5814??2010-11-16?20:24??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\goodsManage.resx
?????文件???????4191??2013-05-14?21:02??51CTO下載-C#?倉(cāng)庫(kù)管理系統(tǒng)\20063262劉振明\系統(tǒng)\cangku\cangku\goodsModify.cs
............此處省略168個(gè)文件信息
評(píng)論
共有 條評(píng)論