예제 #1
0
        /**************************************************************************/

        private void BuildWorksheetOverview(
            MacroscopeJobMaster JobMaster,
            CsvWriter ws
            )
        {
            MacroscopeDocumentCollection DocCollection = JobMaster.GetDocCollection();

            {
                ws.WriteField("URL");
                ws.WriteField("Status Code");
                ws.WriteField("Status");
                ws.WriteField("Redirect");
                ws.WriteField("Robots");
                ws.WriteField("Duration");
                ws.WriteField("Crawled Date");
                ws.WriteField("Server Date");
                ws.WriteField("Modified Date");
                ws.WriteField("Expires Date");
                ws.WriteField("Content-Type");
                ws.WriteField("Charset");
                ws.WriteField("Locale");
                ws.WriteField("Language");
                ws.WriteField("Canonical");
                ws.WriteField("Page Depth");
                ws.WriteField("Links In");
                ws.WriteField("Links Out");
                ws.WriteField("Hyperlinks In");
                ws.WriteField("Hyperlinks Out");
                ws.WriteField("Ration In");
                ws.WriteField("Ratio Out");
                ws.WriteField("Author");
                ws.WriteField("Title");
                ws.WriteField("Title Length");
                ws.WriteField("Description");
                ws.WriteField("Description Length");
                ws.WriteField("Keywords");
                ws.WriteField("Keywords Length");
                ws.WriteField("Keywords Count");
                ws.WriteField("Error Condition");

                ws.NextRecord();
            }

            foreach (MacroscopeDocument msDoc in DocCollection.IterateDocuments())
            {
                List <decimal> HyperlinkRatio = DocCollection.GetDocumentHyperlinksRatio(Url: msDoc.GetUrl());

                this.InsertAndFormatUrlCell(ws, msDoc);

                this.InsertAndFormatStatusCodeCell(ws, msDoc);

                this.InsertAndFormatContentCell(ws, msDoc.GetStatusCode().ToString());

                this.InsertAndFormatRedirectCell(ws, msDoc);

                this.InsertAndFormatRobotsCell(ws, msDoc);

                this.InsertAndFormatContentCell(ws, msDoc.GetDurationInSecondsFormatted());

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetCrawledDate()));

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetDateServer()));

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetDateModified()));

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetDateExpires()));

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetMimeType()));

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetCharacterSet()));

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetLocale()));

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetIsoLanguageCode()));

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetCanonical()));

                this.InsertAndFormatContentCell(ws, msDoc.GetDepth().ToString());

                this.InsertAndFormatContentCell(ws, msDoc.CountInlinks().ToString());
                this.InsertAndFormatContentCell(ws, msDoc.CountOutlinks().ToString());

                this.InsertAndFormatContentCell(ws, msDoc.CountHyperlinksIn().ToString());
                this.InsertAndFormatContentCell(ws, msDoc.CountHyperlinksOut().ToString());

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(string.Format("{0:0.00}%", HyperlinkRatio[0])));
                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(string.Format("{0:0.00}%", HyperlinkRatio[1])));

                this.InsertAndFormatContentCell(ws, msDoc.GetAuthor());

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetTitle()));

                this.InsertAndFormatContentCell(ws, msDoc.GetTitleLength().ToString());

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetDescription()));
                this.InsertAndFormatContentCell(ws, msDoc.GetDescriptionLength().ToString());

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetKeywords()));
                this.InsertAndFormatContentCell(ws, msDoc.GetKeywordsLength().ToString());
                this.InsertAndFormatContentCell(ws, msDoc.GetKeywordsCount().ToString());

                this.InsertAndFormatContentCell(ws, this.FormatIfMissing(msDoc.GetErrorCondition()));

                ws.NextRecord();
            }
        }
예제 #2
0
        /**************************************************************************/

        private void BuildWorksheetOverview(
            MacroscopeJobMaster JobMaster,
            XLWorkbook wb,
            string WorksheetLabel
            )
        {
            var ws = wb.Worksheets.Add(WorksheetLabel);

            int iRow    = 1;
            int iCol    = 1;
            int iColMax = 1;

            MacroscopeDocumentCollection DocCollection = JobMaster.GetDocCollection();

            {
                ws.Cell(iRow, iCol).Value = "URL";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Status Code";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Status";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Redirect";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Robots";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Duration";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Crawled Date";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Server Date";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Modified Date";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Expires Date";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Content-Type";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Charset";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Locale";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Language";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Canonical";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Page Depth";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Links In";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Links Out";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Hyperlinks In";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Hyperlinks Out";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Ratio In";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Ratio Out";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Author";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Title";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Title Length";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Description";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Description Length";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Keywords";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Keywords Length";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Keywords Count";
                iCol++;

                ws.Cell(iRow, iCol).Value = "Error Condition";

                for (int i = 1; i <= iCol; i++)
                {
                    ws.Cell(iRow, i).Style.Font.SetBold();
                }
            }

            iColMax = iCol;

            iRow++;

            foreach (MacroscopeDocument msDoc in DocCollection.IterateDocuments())
            {
                List <decimal> HyperlinkRatio = DocCollection.GetDocumentHyperlinksRatio(Url: msDoc.GetUrl());

                iCol = 1;

                this.InsertAndFormatUrlCell(ws, iRow, iCol, msDoc);
                iCol++;

                this.InsertAndFormatStatusCodeCell(ws, iRow, iCol, msDoc);
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(msDoc.GetStatusCode().ToString()));
                iCol++;

                this.InsertAndFormatRedirectCell(ws, iRow, iCol, msDoc);
                iCol++;

                this.InsertAndFormatRobotsCell(ws, iRow, iCol, msDoc);
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.GetDurationInSecondsFormatted());
                iCol++;

                this.InsertAndFormatDateCell(ws, iRow, iCol, msDoc.GetCrawledDate());
                iCol++;

                this.InsertAndFormatDateCell(ws, iRow, iCol, msDoc.GetDateServer());
                iCol++;

                this.InsertAndFormatDateCell(ws, iRow, iCol, msDoc.GetDateModified());
                iCol++;

                this.InsertAndFormatDateCell(ws, iRow, iCol, msDoc.GetDateExpires());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(msDoc.GetMimeType()));
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(msDoc.GetCharacterSet()));
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(msDoc.GetLocale()));
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(msDoc.GetIsoLanguageCode()));
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(msDoc.GetCanonical()));
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.GetDepth().ToString());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.CountInlinks());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.CountOutlinks());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.CountHyperlinksIn());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.CountHyperlinksOut());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, string.Format("{0:0.00}%", HyperlinkRatio[0]));
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, string.Format("{0:0.00}%", HyperlinkRatio[1]));
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.GetAuthor());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(msDoc.GetTitle()));
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.GetTitleLength().ToString());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(msDoc.GetDescription()));
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.GetDescriptionLength());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(msDoc.GetKeywords()));
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.GetKeywordsLength().ToString());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, msDoc.GetKeywordsCount().ToString());
                iCol++;

                this.InsertAndFormatContentCell(ws, iRow, iCol, this.FormatIfMissing(msDoc.GetErrorCondition()));

                iRow++;
            }

            {
                var rangeData  = ws.Range(1, 1, iRow - 1, iColMax);
                var excelTable = rangeData.CreateTable();
            }
        }