private Dictionary <string, LeaderInfo> GetLeaderInfo() { var targetPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "辅助表.xlsx"); Workbook book = new Workbook(); book.Open(targetPath); var dataSheet = book.Worksheets["Sheet1"]; int startPos = 1; Dictionary <string, LeaderInfo> result = new Dictionary <string, LeaderInfo>(); while (!string.IsNullOrEmpty(dataSheet.Cells[startPos, 0].StringValue)) { LeaderInfo info = new LeaderInfo(); info.RealName = dataSheet.Cells[startPos, 0].StringValue; info.Gender = dataSheet.Cells[startPos, 1].StringValue; info.Age = ParseFrom <int>(dataSheet.Cells[startPos, 2].StringValue); info.NickName = dataSheet.Cells[startPos, 3].StringValue; info.Job = dataSheet.Cells[startPos, 4].StringValue; info.Follower = ParseFrom <int>(dataSheet.Cells[startPos, 5].StringValue); info.Following = ParseFrom <int>(dataSheet.Cells[startPos, 6].StringValue); info.AvgFoward = ParseFrom <double>(dataSheet.Cells[startPos, 7].StringValue); info.AvgComment = ParseFrom <double>(dataSheet.Cells[startPos, 8].StringValue); info.AvgFollowersFollower = ParseFrom <double>(dataSheet.Cells[startPos, 9].StringValue); info.Rank = ParseFrom <double>(dataSheet.Cells[startPos, 10].StringValue); if (!string.IsNullOrEmpty(info.NickName)) { result.Add(info.NickName, info); } startPos++; } return(result); }
private static void BuildOneItem(DetailResult item, OutputFormatBuilder builder) { builder.Build("ItemID", item.ItemID); builder.Build("ParentItemID", item.ParentItemID); builder.Build("CrawlID", item.CrawlID); builder.Build("CleanTitle", item.CleanTitle); builder.Build("CleanText", item.CleanText); builder.Build("Url", item.Url); builder.Build("PubDate", item.PubDate); builder.Build("FetchTime", item.PubDate); builder.Build("ReplyCount", item.ReplyCount); builder.Build("ForwardCount", item.ForwardCount); builder.Build("ViewCount", item.ViewCount); builder.Build("CurrentHistoryFetchTime", item.CurrentHistoryFetchTime); builder.Build("KeywordQuery", item.KeywordQuery); builder.Build("MediaID", item.MediaID); builder.Build("ParentMediaID", item.ParentMediaID); builder.Build("MediaName", item.MediaName); builder.Build("Channel", item.Channel); builder.Build("MediaType", item.MediaType); builder.Build("MediaTendency", item.MediaTendency); builder.Build("MediaOrganType", item.MediaOrganType); builder.Build("MediaElitismType", item.MediaElitismType); builder.Build("MediaWeight", item.MediaWeight); builder.Build("MediaStyle", item.MediaStyle); builder.Build("RegionType", item.RegionType); builder.Build("AuthorName", item.AuthorName); builder.Build("AuthorID", item.AuthorID); builder.Build("AuthorCertificated", item.AuthorCertificated); builder.Build("Source", item.Source); builder.Build("IsPublicLeader", item.IsPublicLeader); LeaderInfo leaderInfo = item.LeaderInfo ?? new LeaderInfo(); builder.Build("Rank", leaderInfo.Rank); builder.Build("Gender", leaderInfo.Gender); builder.Build("Job", leaderInfo.Job); builder.Build("Age", leaderInfo.Age); builder.Build("Follower", leaderInfo.Follower); builder.Build("Following", leaderInfo.Following); builder.Build("TweetCount", ""); //目前没有对应的微博数 builder.Build("AvgFoward", leaderInfo.AvgFoward); builder.Build("AvgComment", leaderInfo.AvgComment); builder.Build("AvgFollowersFollower", leaderInfo.AvgFollowersFollower); builder.Build("HasAttachUrl", item.HasAttachUrl); builder.Build("AttachUrl", item.AttachUrl); builder.Build("GovProcess", item.GovProcess); builder.Build("ArticleHot", item.ArticleHot); builder.Build("CrawlName", item.CrawlName); builder.NewLine(); }