ObjectManager/Common/ExcelOP.cs
(开头部分) 16KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using Microsoft.Office.Interop.Excel;
using ObjectManager.Models;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ObjectManager.Common
{
public class ExcelOP
{
public void BuildExcel()
{
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbooks wbks = app.Workbooks;
string filePath = Util.FileHelper.GetNowPath() + "\\" + Guid.NewGuid().ToString("N") + ".xls";
try
{
_Workbook _wbk = wbks.Add();
//app.Worksheets.Add();
//获取sheet
Sheets shs = _wbk.Sheets;
if(shs.Count >0)
{
for(int x=0;x<shs.Count;x++)
{
//((Microsoft.Office.Interop.Excel.Worksheet)shs[x+1]).Delete();
}
}
//查找当前所有的开发组
DBContext dbc = new DBContext();
List<TB_DevelopmentTeam> developmentTeamList = dbc.TB_DevelopmentTeam.ToList();
for(int x = 0;x<developmentTeamList.Count;x++)
{
Worksheet tempws = shs.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing);
tempws.Name = developmentTeamList[x].Name;
//插入数据
//获取当前项目组下所有人员
List<TB_Member> memberList = developmentTeamList[x].TB_Member.ToList();
if(memberList.Count==0)
{
continue;
}
List<TB_ObjectModelJoinMember> objectModelJoinMembers = dbc.TB_ObjectModelJoinMember.ToList();
//获取所有人最小的开始时间,和最大的结束时间
var t = from c in memberList
后面还有 286 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
