Ejemplo n.º 1
0
 public BodyBuilder(ExcelDocumentRequest <T> Request, HeaderBuilder <T> Header)
 {
     BodyStyle       = Request.BodyStyle;
     DataItems       = Request.ItemsToExport;
     this.Header     = Header;
     HeaderCellStyle = Request.HeaderStyle.CellStyle ?? Request.HeaderStyle.GenerateStyleObject(Request.Workbook);
     BodyCellStyle   = BodyStyle.GenerateStyleObject(Request.Workbook);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a request object thats used to export data into a spreadsheet
        /// </summary>
        /// <param name="FileName">Filename of the spreadsheet</param>
        /// <param name="ItemsToExport">Data to be exported</param>
        /// <param name="HeaderStyle">Header row's style</param>
        /// <param name="BodyStyle">Style of the body rows</param>
        public ExcelDocumentRequest(string FileName, IEnumerable <T> ItemsToExport, HeaderStyle HeaderStyle = null, BodyStyle BodyStyle = null)
        {
            Workbook = new XSSFWorkbook();

            this.ItemsToExport = ItemsToExport ?? throw new ArgumentNullException($"{nameof(ItemsToExport)}: you provided nothing to export");
            this.HeaderStyle   = HeaderStyle ?? new HeaderStyle();
            this.BodyStyle     = BodyStyle ?? new BodyStyle();


            if (MimeMapping.IsExtensionMissing(FileName))
            {
                this.FileName = FileName += ".xlsx";
            }
            else
            {
                this.FileName = FileName;
            }

            this.HeaderStyle.GenerateStyleObject(Workbook);
            this.BodyStyle.GenerateStyleObject(Workbook);
        }
Ejemplo n.º 3
0
 public BodyBuilder(IWorkbook workBook, HeaderBuilder <T> Header, IEnumerable <T> DataItems, BodyStyle BodyStyle, HeaderStyle HeaderStyle)
 {
     this.BodyStyle  = BodyStyle;
     this.DataItems  = DataItems;
     this.Header     = Header;
     HeaderCellStyle = HeaderStyle.CellStyle ?? HeaderStyle.GenerateStyleObject(workBook);
     BodyCellStyle   = BodyStyle.GenerateStyleObject(workBook);
 }