WebClass/ExcelReader.cs
(开头部分) 13KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using Utils;
namespace WebClass
{
public class ExcelReader
{
private object missing = Missing.Value;
private Application _excelApp;
private Workbook _workBook;
private Worksheet _workSheet;
private Range _range;
private string _dym;
public int qiyeid
{
get;
set;
}
public ExcelReader(string path)
{
if (!File.Exists(path))
{
throw new FileNotFoundException(path + "无法找到该文件");
}
this._dym = Path.GetFileNameWithoutExtension(path);
this._excelApp = (Application)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("00024500-0000-0000-C000-000000000046")));
this._workBook = this._excelApp.Application.Workbooks.Open(path, this.missing, true, this.missing, this.missing, this.missing, this.missing, this.missing, this.missing, true, this.missing, this.missing, this.missing, this.missing, this.missing);
this._workSheet = (this._workBook.Worksheets.get_Item(1) as Worksheet);
}
public List<int> getShouFei(huadushuiEntities db)
{
int c = this._workSheet.UsedRange.Count;
List<int> cannotimport = new List<int>();
for (int i = 0; i < c; i++)
{
this._range = this._workSheet.get_Range("A" + (i + 1), "J" + (i + 1));
Array array = this._range.Value2 as Array;
if (array.GetValue(1, 1) == null)
{
break;
}
string idstr = array.GetValue(1, 1).ToString();
int id = 0;
int.TryParse(idstr, out id);
if (id != 0)
{
后面还有 315 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
