コード例 #1
0
        /// <summary>
        /// 将数据写入一个指定名称的表格
        /// </summary>
        public WorkbookWriter WriteSheet <TModel>(string sheetName, SheetWriterBuilder <TModel> builder, IEnumerable <TModel> source)
        {
            ISheet sheet = workBook.GetSheet(sheetName) ?? workBook.CreateSheet(sheetName);
            SheetWriter <TModel> writer = builder.Build(sheet);

            writer.Write(source);

            return(this);
        }
コード例 #2
0
        /// <summary>
        /// 将数据写入一个新的表格
        /// </summary>
        public WorkbookWriter WriteSheet <TModel>(SheetWriterBuilder <TModel> builder, IEnumerable <TModel> source)
        {
            var sheetName = $"Sheet{workBook.NumberOfSheets + 1}";

            return(WriteSheet(sheetName, builder, source));
        }