各位大侠:
我想用dreamwear+asp.net做一个网站,涉及到在网页上读取,修改excel表格内容,不知道哪们有没有这方面的资料啊要,相关源码最好。
我想用dreamwear+asp.net做一个网站,涉及到在网页上读取,修改excel表格内容,不知道哪们有没有这方面的资料啊要,相关源码最好。
解决方案 »
- 关于ASPxGridView控件的DetailRowExpandedChanged事件的问题
- c#获取存储过程输出参数
- 求精点SQL语句(获取每种分类下的产品ID最大的产品)
- 关于datagrid的天下最奇怪的问题,
- 怎样取文本框的值多行的,我只能取第一行?
- 菜鸟问题,呵呵!在textbox点按钮显示查询
- 急 ASP.NET 怎么把url变成 1bae901e-e21c-4d2d-955f-25fd664d73fd.html
- "孟子E章"真是好人,狂高兴,散分!
- 如何准确记录用户浏览网站的时间【登录到退出的时间差】,用户可能在某页停留很长时间,如超过20分钟
- 关于格式的问题
- 读取excel, 让用户选出的几个列,将数据导入到sql server,如何实现!
- GridView更新操作问题
Excel.Workbooks wbs = null;
Excel.Workbook wb = null;
Excel.Worksheet ws = null;
Excel.Range range1 = null;
object Nothing = System.Reflection.Missing.Value;
try
{
excel = new Excel.Application();
excel.UserControl = true;
excel.DisplayAlerts = false;
excel.Application.Workbooks.Open(this.FilePath,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing ) ;
wbs = excel.Workbooks;
wb = wbs[1];
ws = (Excel.Worksheet)wb.Worksheets["Sheet2"];
int rowCount = ws.UsedRange.Rows.Count;
int colCount = ws.UsedRange.Columns.Count;
if (rowCount <= 0)
throw new InvalidFormatException("文件中没有数据记录");
if (colCount < 4 )
throw new InvalidFormatException("字段个数不对");
for (int i = 0;i { this.rowNo = i + 1;
object[] row = new object[4];
for (int j = 0;j<4;j++)
{
range1 = ws.get_Range(ws.Cells[i+2,j+1],ws.Cells[i+2,j+1]);
row[j] = range1.Value; if (row[0] == null)
{
this.isNullRecord++;
break;
}
}
if (this.isNullRecord > 0)
continue; DataRow dataRow = this.readExcel(row); if (this.isNullRecord == 1)
continue;
if (this.verifyData(dataRow) == false)
errFlag++;
this.updateTableCurr(dataRow);
}
}
finally
{
if (excel != null)
{
if (wbs != null)
{
if (wb != null)
{
if (ws != null)
{
if (range1 != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(range1);
range1 = null;
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(ws);
ws = null;
}
wb.Close(false,Nothing,Nothing);
System.Runtime.InteropServices.Marshal.ReleaseComObject(wb);
wb = null;
}
wbs.Close();
System.Runtime.InteropServices.Marshal.ReleaseComObject(wbs);
wbs = null;
}
excel.Application.Workbooks.Close();
excel.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
excel = null;
GC.Collect();
}
}