コード例 #1
0
    public void Save(string path)
    {
        using (var workbook = new XLWorkbook())
        {
            //TODO: improve worksheet title with more information than date or something else
            IXLWorksheet ws = workbook.Worksheets.Add("Pull Request Stat");

            var header = new string[] { "Id", "Repository", "Title", "Description", "CreationDate", "ClosedDate", "Duration", "CreatedBy", "Reviewers", "Comments #" };
            AddValues(ws.Row(1), header);
            AddModel(ws.Row(2));

            ws.Columns().AdjustToContents();
            IXLTable table = ws.RangeUsed().CreateTable();
            table.Sort("CreationDate", XLSortOrder.Descending);

            workbook.SaveAs(path);
        }
    }