private void ProcessHtmlChunks(HtmlEnumerator en, String endTag) { while (en.MoveUntilMatch(endTag)) { if (en.IsCurrentHtmlTag) { Action <HtmlEnumerator> action; if (knownTags.TryGetValue(en.CurrentTag, out action)) { if (Logging.On) { Logging.PrintVerbose(en.Current); } action(en); } // else unknown or not yet implemented - we ignore } else { // apply the previously discovered style Run run = new Run( new Text(HttpUtility.HtmlDecode(en.Current)) { Space = SpaceProcessingModeValues.Preserve } ); htmlStyles.Runs.ApplyTags(run); elements.Add(run); } } }
/// <summary> /// Iterate over the html tags and process them. /// </summary> /// <param name="en"></param> /// <param name="endTag"></param> protected void ProcessHtmlChunks(HtmlEnumerator en, string endTag) { while (en.MoveUntilMatch(endTag)) { if (en.IsCurrentHtmlTag) { Action <HtmlEnumerator> action; if (en.CurrentTag != null && knownTags.TryGetValue(en.CurrentTag, out action)) { // Process known tag if (Logging.On) { Logging.PrintVerbose(en.Current); } action(en); } else { // Just print unknown tag as text Run run = new Run( new Text(HttpUtility.HtmlDecode(en.Current)) { Space = SpaceProcessingModeValues.Preserve } ); htmlStyles.Runs.ApplyTags(run); elements.Add(run); } } else { // Print text and apply the previously discovered style Run run = new Run( new Text(HttpUtility.HtmlDecode(en.Current)) { Space = SpaceProcessingModeValues.Preserve } ); htmlStyles.Runs.ApplyTags(run); elements.Add(run); } } }