满意答案
zrtzz01
2016.04.02
采纳率:49% 等级:10
已帮助:319人
public List SubmitReport(System.IO.Stream stream, DateTime reportDuration, Guid reportOrganID, int adminorganType, ReportPeriod period)
{
List resultList = new List ();
//从压缩包中读取报表编码
ZipFile zip = new ZipFile(stream);
foreach (ZipEntry entry in zip)
{
if (entry.IsFile && (entry.Name.EndsWith( ".xls ") || entry.Name.EndsWith( ".XLS "))) {
ReportInputResult result = new ReportInputResult();
Stream inputStream;
ExcelDataSheetReader excelSheet;
string reportType;
try//判断上传的文件是否是EXCEL文件
{
inputStream = zip.GetInputStream(entry);
excelSheet = new ExcelDataSheetReader(inputStream, 0);
excelSheet.SkipToRow(1);
excelSheet.SkipToColumn(1);
reportType = excelSheet.Read();
}
catch(Exception ex)
{
result.ReportName = entry.Name;
result.ErrorMessage = "上传失败:文件格式无法识别! " + ex.Message;
result.IsSuccess = false;
resultList.Add(result);
continue;
}
}
}
return resultList;
}追问: orz这是什么语言
13分享举报