/// <summary> /// Constructor. Writes metadata and Id column header to excel. /// </summary> public ExcelPresenterBase(string type, IExcelFile file, Views.IExportDialog dialog) { Views.Excel.Excel excel = new Views.Excel.Excel(); this._dialog = dialog; this._file = file; this._type = type; this._dialog.Title = this._type; this._dialog.Label1 = string.Empty; this._dialog.Label2 = string.Empty; this._dialog.StartButtonEnabled = false; // create styles // headers and metadata var namedStyle = excel.Package.Workbook.Styles.CreateNamedStyle(HEADER_AND_META_STYLE); namedStyle.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; namedStyle.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(255, 0, 0, 170)); namedStyle.Style.Font.Bold = true; namedStyle.Style.Font.Color.SetColor(Color.FromArgb(255, 255, 255, 255)); namedStyle.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center; // even data row namedStyle = excel.Package.Workbook.Styles.CreateNamedStyle(EVEN_ROW_STYLE); namedStyle.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; namedStyle.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(255, 239, 239, 255)); // odd data row namedStyle = excel.Package.Workbook.Styles.CreateNamedStyle(ODD_ROW_STYLE); namedStyle.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; namedStyle.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(255, 207, 207, 255)); // write metadata excel.Worksheet = excel.Package.Workbook.Worksheets.Add(type); excel.Worksheet.Cells["A1"].Value = "MyLibrary"; excel.Worksheet.Cells[1, 1, 1, 2].Merge = true; excel.Worksheet.Cells["A2"].Value = "Type"; excel.Worksheet.Cells["B2"].Value = this._type + "s"; excel.Worksheet.Cells["A3"].Value = "App Version:"; excel.Worksheet.Cells["B3"].Value = Configuration.APP_VERSION.ToString(); excel.Worksheet.Cells["A4"].Value = "Extracted At:"; excel.Worksheet.Cells["B4"].Value = DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"); excel.Worksheet.Cells["A1:B4"].StyleName = HEADER_AND_META_STYLE; excel.Worksheet.Cells["A1:B4"].AutoFitColumns(); this._excel = excel; // write Id column header WriteHeaderCell("A", "Id"); // set the current row to the first data row, ready for writing entities this._currRow = HEADER_ROW + 1; // subscribe to dialog view's events this._dialog.BrowseButtonClicked += BrowseButtonClicked; this._dialog.StartButtonClicked += (async(sender, args) => { await HandleStartButtonClicked(sender, args); }); this._dialog.Cancelled += Closed; this._dialog.Title = "Export " + this._type + "s"; }
public TagExcelPresenter(Views.IExportDialog dialog) : base("Tag", new ExcelFile(), dialog) { this._tagService = new TagService(); WriteHeaders(); }
public TagExcelPresenter(ITagService tagService, IExcelFile file, Views.IExportDialog dialog) : base("Tag", file, dialog) { this._tagService = tagService; WriteHeaders(); }
public BookExcelPresenter(Views.IExportDialog dialog) : base("Book", new ExcelFile(), dialog) { this._bookService = new BookService(); WriteHeaders(); }
public MediaItemExcelPresenter(Views.IExportDialog dialog) : base("Media item", new ExcelFile(), dialog) { this._mediaItemService = new MediaItemService(); WriteHeaders(); }
public BookExcelPresenter(IBookService bookService, IExcelFile file, Views.IExportDialog dialog) : base("Book", file, dialog) { this._bookService = bookService; WriteHeaders(); }
public WishlistExcelPresenter(Views.IExportDialog dialog) : base("Wishlist item", new ExcelFile(), dialog) { this._wishlistService = new WishlistService(); WriteHeaders(); }
public MediaItemExcelPresenter(IMediaItemService tagService, IExcelFile file, Views.IExportDialog dialog) : base("Media item", file, dialog) { this._mediaItemService = tagService; WriteHeaders(); }
public WishlistExcelPresenter(IWishlistService wishlistService, IExcelFile file, Views.IExportDialog dialog) : base("Wishlist item", file, dialog) { this._wishlistService = wishlistService; WriteHeaders(); }
public AuthorExcelPresenter(Views.IExportDialog dialog) : base("Author", new ExcelFile(), dialog) { this._authorService = new AuthorService(); WriteHeaders(); }
public AuthorExcelPresenter(IAuthorService authorService, IExcelFile file, Views.IExportDialog dialog) : base("Author", file, dialog) { this._authorService = authorService; WriteHeaders(); }
public PublisherExcelPresenter(Views.IExportDialog dialog) : base("Publisher", new ExcelFile(), dialog) { this._publisherService = new PublisherService(); WriteHeaders(); }
public PublisherExcelPresenter(IPublisherService publisherService, IExcelFile file, Views.IExportDialog dialog) : base("Publisher", file, dialog) { this._publisherService = publisherService; WriteHeaders(); }