/// <summary> /// Converts HTML content returned by a dictionary to a <see cref="Section"/>. /// </summary> /// <param name="dictionary">The dictionary. It is neccessary to retrieve CSS files referenced by the HTML content.</param> /// <param name="htmlContent">The HTML to convert.</param> /// <returns>A <see cref="Section"/> that represents the HTML content.</returns> public Section ConvertHtmlContentToSection(IWordDictionary dictionary, string htmlContent) { Func <string, string, string> cssStyleSheetProvider = (cssFileName, refFileName) => { if (dictionary.TryGetValue(cssFileName, out var entry)) { return(entry.Content); } else { return(null); } }; try { var section = (Section)_converter.Convert(htmlContent, false, cssStyleSheetProvider, null); return(section); } catch (Exception ex) { } return(null); }