Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        private byte[] ProcessHtmlDocument(HtmlDocument htmlDoc)
        {
            HtmlNode table = new HtmlAgilityUtilities().GetHtmlTableNode(htmlDoc);

            return(new EPPlusUtilities(HtmlToExcelSettings).GenerateWorkbookFromHtmlNode(table));
        }