/// <summary> /// Add a new sheet to the workbook that is being created /// </summary> /// <param name="sheetName">Name of the sheet</param> /// <param name="htmlString">HTML string to generate the the table from</param> /// <param name="settings">Settings for this sheet only.</param> /// <returns></returns> public WorkbookBuilder AddSheet(string sheetName, string htmlString, HtmlToExcelSettings settings = null) { IBrowsingContext context = BrowsingContext.New(Configuration.Default); var document = context.OpenAsync(req => req.Content(htmlString)).Result; new EPPlusUtilities(settings ?? Settings).CreateSheet(Package, sheetName, document.DocumentElement); return(this); }
/// <summary> /// Add a new sheet to the workbook that is being created /// </summary> /// <param name="sheetName">Name of the sheet</param> /// <param name="htmlString">HTML string to generate the the table from</param> /// <param name="settings">Settings for this sheet only.</param> /// <returns></returns> public WorkbookBuilder AddSheet(string sheetName, string htmlString, HtmlToExcelSettings settings = null) { IBrowsingContext context = BrowsingContext.New(Configuration.Default); IElement htmlDoc = context.OpenAsync(req => req.Content(htmlString)).Result.DocumentElement; IElement table = new AngleSharpUtilities().GetHtmlTableNode(htmlDoc); new ClosedXmlUtilities(settings ?? Settings).CreateWorksheet(Workbook, sheetName, table); return(this); }
/// <summary> /// Add a new sheet to the workbook that is being created /// </summary> /// <param name="sheetName">Name of the sheet</param> /// <param name="htmlString">HTML string to generate the the table from</param> /// <param name="settings">Settings for this sheet only.</param> /// <returns></returns> public WorkbookBuilder AddSheet(string sheetName, string htmlString, HtmlToExcelSettings settings = null) { HtmlDocument htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(htmlString); HtmlNode node = new HtmlAgilityUtilities().GetHtmlTableNode(htmlDoc); new EPPlusUtilities(settings ?? Settings).CreateSheet(Package, sheetName, node); return(this); }
/// <summary> /// Constructor for customizing the settings /// </summary> /// <param name="settings">Settings to use for this class instance</param> public WorkbookBuilder(HtmlToExcelSettings settings) { Settings = settings; Package = new ExcelPackage(); }
/// <summary> /// Create a new WorkbookGenerator instance with custom settings /// </summary> /// <param name="settings">Settings class with customized settings</param> public WorkbookGenerator(HtmlToExcelSettings settings) { HtmlToExcelSettings = settings; }
/// <summary> /// Create a new WorkbookGenerator instance with the default settings /// </summary> public WorkbookGenerator() { HtmlToExcelSettings = HtmlToExcelSettings.Defaults; }
internal EPPlusUtilities(HtmlToExcelSettings settings) { Settings = settings; }
/// <summary> /// Constructor for customizing the settings /// </summary> /// <param name="settings">Settings to use for this class instance</param> public WorkbookBuilder(HtmlToExcelSettings settings) { Settings = settings; Workbook = new XLWorkbook(); }