/// <summary>
        /// Adds new excel sheet.
        /// </summary>
        /// <param name="reportRenderer">Report renderer.</param>
        /// <param name="reportRows">Report rows.</param>
        /// <param name="fillCellReferences">Fill cell references after sheet builded.</param>
        /// <returns>Builder instance.</returns>
        public ExcelReportBuilder AddReportSheet(
            IReportRenderer reportRenderer,
            IEnumerable <IPropertyContainer> reportRows,
            bool fillCellReferences = true)
        {
            reportRenderer.AssertArgumentNotNull(nameof(reportRenderer));
            reportRows.AssertArgumentNotNull(nameof(reportRows));

            var sheetMetadata = reportRenderer.GetMetadata <ExcelSheetMetadata>() ?? _defaultSheetMetadata;

            // Add a WorksheetPart to the WorkbookPart.
            WorkbookPart  workbookPart  = _documentContext.Document.WorkbookPart;
            uint          sheetCount    = workbookPart.GetSheetCount();
            WorksheetPart worksheetPart = workbookPart.AddNewPart <WorksheetPart>($"sheet{sheetCount+1}");

            var sheetContext = new SheetContext(_documentContext, worksheetPart, sheetMetadata, reportRenderer);

            AddSheet(sheetContext);

            AddSheetData(sheetContext, reportRows);

            if (fillCellReferences)
            {
                sheetContext.SheetElement.FillCellReferences(forceFill: fillCellReferences);
            }

            // External customization
            var configureSheet = ExcelSheetMetadata.ConfigureSheet.GetFirstDefinedValue(
                sheetContext.SheetMetadata,
                _documentMetadata);

            configureSheet?.Invoke(sheetContext);

            return(this);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SheetContext"/> class.
 /// </summary>
 /// <param name="documentContext">Document context.</param>
 /// <param name="worksheetPart">WorksheetPart.</param>
 /// <param name="sheetMetadata">Sheet configuration metadata.</param>
 /// <param name="reportRenderer">Renderer for sheet.</param>
 public SheetContext(
     DocumentContext documentContext,
     WorksheetPart worksheetPart,
     IExcelMetadata sheetMetadata,
     IReportRenderer reportRenderer)
 {
     DocumentContext = documentContext.AssertArgumentNotNull(nameof(documentContext));
     WorksheetPart   = worksheetPart.AssertArgumentNotNull(nameof(worksheetPart));
     SheetMetadata   = sheetMetadata.AssertArgumentNotNull(nameof(sheetMetadata));
     ReportRenderer  = reportRenderer.AssertArgumentNotNull(nameof(reportRenderer));
 }