internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } paragraph = null; Paragraph hrParagraph = node.Parent.AppendChild(new Paragraph()); OnParagraphCreated(node, hrParagraph); if (hrParagraph.ParagraphProperties == null) { hrParagraph.ParagraphProperties = new ParagraphProperties(); } ParagraphBorders paragraphBorders = new ParagraphBorders(); DocxBorder.ApplyDefaultBorder <TopBorder>(paragraphBorders); hrParagraph.ParagraphProperties.Append(paragraphBorders); Run run = hrParagraph.AppendChild(new Run(new Text())); RunCreated(node, run); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || node.Parent == null || !CanConvert(node) || IsHidden(node)) { return; } paragraph = null; if (node.HasChildren) { Table table = new Table(); DocxTableProperties tableProperties = new DocxTableProperties(); tableProperties.FetchTableProperties(node); tableProperties.ApplyTableProperties(table, node); foreach (DocxNode child in node.Children) { if (string.Compare(child.Tag, DocxTableProperties.trName, StringComparison.InvariantCultureIgnoreCase) == 0) { node.CopyExtentedStyles(child); ProcessTr(child, table, tableProperties); } else if (tableProperties.IsGroupElement(child.Tag)) { node.CopyExtentedStyles(child); ProcessGroupElement(child, table, tableProperties); } } node.Parent.Append(table); } }
internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties) { if (node.IsNull() || !CanConvert(node) || IsHidden(node)) { return; } paragraph = null; int levelIndex = properties.ContainsKey(levelIndexName) ? Convert.ToInt32(properties[levelIndexName]) : 0; if (node.HasChildren) { short numberId = gNumberId = ++context.ListNumberId; InitNumberDefinitions(levelIndex); var newProperties = properties.ToDictionary(x => x.Key, x => x.Value); newProperties[levelIndexName] = levelIndex + 1; foreach (DocxNode child in node.Children) { //Dirty hack to maintain the level since these elements are singleton. When it traverse to inner html elements, the level will increment //then, when it goes back to more root elements, we have to reset the level to its previous state. gLevelIndex = levelIndex; gNumberId = numberId; if (string.Compare(child.Tag, liName, StringComparison.InvariantCultureIgnoreCase) == 0) { node.CopyExtentedStyles(child); ProcessLi(child, node.Parent, newProperties); } } } }
private void ProcessChild(DocxNode node) { if (node.IsNull()) { return; } Paragraph paragraph = node.Parent.AppendChild(new Paragraph()); OnParagraphCreated(node, paragraph); foreach (DocxNode child in node.Children) { if (child.IsText && !IsEmptyText(child.InnerHtml)) { Run run = paragraph.AppendChild(new Run(new Text() { Text = ClearHtml(child.InnerHtml), Space = SpaceProcessingModeValues.Preserve })); RunCreated(node, run); } else { child.ParagraphNode = node; child.Parent = node.Parent; node.CopyExtentedStyles(child); ProcessChild(child, ref paragraph); } } }
private void ProcessChild(DocxNode node, Dictionary <string, object> properties) { if (node.IsNull()) { return; } Paragraph paragraph = node.Parent.AppendChild(new Paragraph()); OnParagraphCreated(node, paragraph); foreach (DocxNode child in node.Children) { if (child.IsText && !IsEmptyText(child.InnerHtml)) { Run run = paragraph.AppendChild(new Run(new Text() { Text = ClearHtml(child.InnerHtml), Space = SpaceProcessingModeValues.Preserve })); RunCreated(node, run); } else { child.ParagraphNode = node; child.Parent = node.Parent; node.CopyExtentedStyles(child); ProcessChild(child, ref paragraph, properties); } } }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || !CanConvert(node) || IsHidden(node)) { return; } paragraph = null; if (node.HasChildren) { numberFormat = GetNumberFormat(node); InitNumberDefinitions(numberFormat); foreach (DocxNode child in node.Children) { if (string.Compare(child.Tag, liName, StringComparison.InvariantCultureIgnoreCase) == 0) { node.CopyExtentedStyles(child); ProcessLi(child, node.Parent, numberFormat); } } } }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } ProcessElement(node, ref paragraph); }
internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } ProcessElement(node, ref paragraph, properties); }
internal void CopyExtentedStyles(DocxNode toNode) { if (toNode.IsNull()) { return; } toNode.SetExtentedStyles(this.extentedStyles); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || IsHidden(node)) { return; } string link = node.ExtractAttributeValue(href); link = CleanUrl(link); if (Uri.IsWellFormedUriString(link, UriKind.Absolute)) { Uri uri = new Uri(link); var relationship = context.MainDocumentPart.AddHyperlinkRelationship(uri, uri.IsAbsoluteUri); var hyperLink = new Hyperlink() { History = true, Id = relationship.Id }; foreach (DocxNode child in node.Children) { if (child.IsText) { if (!IsEmptyText(child.InnerHtml)) { Run run = hyperLink.AppendChild <Run>(new Run(new Text() { Text = ClearHtml(child.InnerHtml), Space = SpaceProcessingModeValues.Preserve })); run.RunProperties = new RunProperties((new RunStyle() { Val = "Hyperlink" })); RunCreated(node, run); } } else { child.Parent = hyperLink; node.CopyExtentedStyles(child); ProcessTextElement(child); } } CreateParagraph(node, ref paragraph); paragraph.Append(hyperLink); } else { ProcessNonLinkText(node, ref paragraph); } }
internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties) { if (node.IsNull() || IsHidden(node)) { return; } node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold); ProcessElement(node, ref paragraph, properties); }
internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties) { if (node.IsNull() || IsHidden(node)) { return; } node.SetExtentedStyle(DocxAlignment.verticalAlign, DocxAlignment.super); ProcessElement(node, ref paragraph, properties); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || IsHidden(node)) { return; } SetStyle(node); ProcessElement(node, ref paragraph); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || IsHidden(node)) { return; } node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold); ProcessElement(node, ref paragraph); }
internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties) { if (node.IsNull() || IsHidden(node)) { return; } node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.lineThrough); ProcessElement(node, ref paragraph, properties); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || IsHidden(node)) { return; } node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.lineThrough); ProcessElement(node, ref paragraph); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || IsHidden(node)) { return; } node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.underLine); ProcessElement(node, ref paragraph); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || IsHidden(node)) { return; } node.SetExtentedStyle(DocxAlignment.verticalAlign, DocxAlignment.sub); ProcessElement(node, ref paragraph); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } paragraph = null; Paragraph headerParagraph = null; ProcessBlockElement(node, ref headerParagraph); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } //Div creates it's own new paragraph. So old paragraph ends here and creats another one after this div //if there any text! paragraph = null; Paragraph divParagraph = null; ProcessBlockElement(node, ref divParagraph); }
internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } paragraph = null; Paragraph headerParagraph = null; ApplyStyle(node); ProcessBlockElement(node, ref headerParagraph, properties); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (!node.IsNull() && node.Parent != null || IsHidden(node)) { if (paragraph == null) { paragraph = node.Parent.AppendChild(new Paragraph()); OnParagraphCreated(node.ParagraphNode, paragraph); } Run run = paragraph.AppendChild(new Run(new Break())); RunCreated(node, run); } }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } //Address tag also creats a new block element. Thus clear the existing paragraph paragraph = null; Paragraph addrParagraph = null; node.SetExtentedStyle(DocxFontStyle.fontStyle, DocxFontStyle.italic); ProcessBlockElement(node, ref addrParagraph); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } paragraph = null; Paragraph centerParagraph = null; node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center); node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center); ProcessBlockElement(node, ref centerParagraph); }
internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } paragraph = null; Paragraph centerParagraph = null; node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center); node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center); ProcessBlockElement(node, ref centerParagraph, properties); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } foreach (DocxNode child in node.Children) { if (child.IsText) { if (!IsEmptyText(child.InnerHtml)) { ApplyOpenQuoteIfEmpty(node, ref paragraph); Run run = paragraph.AppendChild(new Run(new Text() { Text = ClearHtml(child.InnerHtml), Space = SpaceProcessingModeValues.Preserve })); RunCreated(node, run); } } else { child.ParagraphNode = node.ParagraphNode; child.Parent = node.Parent; node.CopyExtentedStyles(child); ApplyOpenQuoteIfEmpty(node, ref paragraph); ProcessChild(child, ref paragraph); } } if (paragraph != null && hasOpenQuote) { paragraph.AppendChild(new Run(new Text() { Text = "\"" })); } }
internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties) { if (node.IsNull() || !CanConvert(node) || IsHidden(node)) { return; } paragraph = null; int levelIndex = properties.ContainsKey(levelIndexName) ? Convert.ToInt32(properties[levelIndexName]) : 0; if (abstractNum == null) { InitNumberDefinitions(); } if (node.HasChildren) { NumberFormatValues numberFormat = GetNumberFormat(node); int levelId = gLevelId = gNextLevelId++; DefineLevel(numberFormat, levelIndex); var newProperties = properties.ToDictionary(x => x.Key, x => x.Value); newProperties[levelIndexName] = levelIndex + 1; foreach (DocxNode child in node.Children) { gLevelIndex = levelIndex; gLevelId = levelId; if (string.Compare(child.Tag, liName, StringComparison.InvariantCultureIgnoreCase) == 0) { node.CopyExtentedStyles(child); ProcessLi(child, node.Parent, newProperties); } } } }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || node.Parent == null || !CanConvert(node) || IsHidden(node)) { return; } if (!node.HasChildren) { return; } paragraph = null; //Add an empty paragraph to set default margin top SetMarginTop(node.Parent); foreach (DocxNode child in node.Children) { if (string.Compare(child.Tag, "dt", StringComparison.InvariantCultureIgnoreCase) == 0) { child.Parent = node.Parent; node.CopyExtentedStyles(child); ProcessChild(child); } else if (string.Compare(child.Tag, "dd", StringComparison.InvariantCultureIgnoreCase) == 0) { node.CopyExtentedStyles(child); SetDDProperties(child); child.Parent = node.Parent; ProcessChild(child); } } //Add an empty paragraph at the end to set default margin bottom SetMarginBottom(node.Parent); }
internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties) { if (node.IsNull() || node.Parent == null || !CanConvert(node) || IsHidden(node)) { return; } if (!node.HasChildren) { return; } paragraph = null; //Add an empty paragraph to set default margin top SetMarginTop(node.Parent); foreach (DocxNode child in node.Children) { if (string.Compare(child.Tag, "dt", StringComparison.InvariantCultureIgnoreCase) == 0) { child.Parent = node.Parent; node.CopyExtentedStyles(child); ProcessChild(child, properties); } else if (string.Compare(child.Tag, "dd", StringComparison.InvariantCultureIgnoreCase) == 0) { node.CopyExtentedStyles(child); SetDDProperties(child); child.Parent = node.Parent; ProcessChild(child, properties); } } //Add an empty paragraph at the end to set default margin bottom SetMarginBottom(node.Parent); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || node.Parent == null || IsHidden(node)) { return; } paragraph = null; Paragraph hrParagraph = node.Parent.AppendChild(new Paragraph()); OnParagraphCreated(node, hrParagraph); if (hrParagraph.ParagraphProperties == null) { hrParagraph.ParagraphProperties = new ParagraphProperties(); } ParagraphBorders paragraphBorders = new ParagraphBorders(); DocxBorder.ApplyDefaultBorder<TopBorder>(paragraphBorders); hrParagraph.ParagraphProperties.Append(paragraphBorders); Run run = hrParagraph.AppendChild(new Run(new Text())); RunCreated(node, run); }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || IsHidden(node)) { return; } string link = node.ExtractAttributeValue(href); link = CleanUrl(link); if (Uri.IsWellFormedUriString(link, UriKind.Absolute)) { Uri uri = new Uri(link); var relationship = context.MainDocumentPart.AddHyperlinkRelationship(uri, uri.IsAbsoluteUri); var hyperLink = new Hyperlink() { History = true, Id = relationship.Id }; foreach (DocxNode child in node.Children) { if (child.IsText) { if (!IsEmptyText(child.InnerHtml)) { Run run = hyperLink.AppendChild<Run>(new Run(new Text() { Text = ClearHtml(child.InnerHtml), Space = SpaceProcessingModeValues.Preserve })); run.RunProperties = new RunProperties((new RunStyle() { Val = "Hyperlink" })); RunCreated(node, run); } } else { child.Parent = hyperLink; node.CopyExtentedStyles(child); ProcessTextElement(child); } } CreateParagraph(node, ref paragraph); paragraph.Append(hyperLink); } else { ProcessNonLinkText(node, ref paragraph); } }
internal override void Process(DocxNode node, ref Paragraph paragraph) { if (node.IsNull() || node.Parent == null || !CanConvert(node) || IsHidden(node)) { return; } paragraph = null; if (node.HasChildren) { Table table = new Table(); DocxTableProperties tableProperties = new DocxTableProperties(); tableProperties.FetchTableProperties(node); tableProperties.ApplyTableProperties(table, node); foreach (DocxNode child in node.Children) { if (string.Compare(child.Tag, DocxTableProperties.trName, StringComparison.InvariantCultureIgnoreCase) == 0) { node.CopyExtentedStyles(child); ProcessTr(child, table, tableProperties); } else if (string.Compare(child.Tag, DocxTableProperties.tbody, StringComparison.InvariantCultureIgnoreCase) == 0) { node.CopyExtentedStyles(child); ProcessTBody(child, table, tableProperties); } } node.Parent.Append(table); } }