private void ApplyStyle(DocxNode node) { string fontFamily = node.ExtractOwnStyleValue(DocxFontStyle.fontFamily); if (string.IsNullOrEmpty(fontFamily)) { string face = node.ExtractAttributeValue("face"); if (!string.IsNullOrEmpty(face)) { node.SetExtentedStyle(DocxFontStyle.fontFamily, face); } } string fontSize = node.ExtractOwnStyleValue(DocxFontStyle.fontSize); if (string.IsNullOrEmpty(fontSize)) { SetFontSize(node); } string color = node.ExtractOwnStyleValue(DocxColor.color); if (string.IsNullOrEmpty(color)) { color = node.ExtractAttributeValue("color"); if (!string.IsNullOrEmpty(color)) { node.SetExtentedStyle(DocxColor.color, color); } } }
private void ApplyStyle(DocxNode node) { string fontFamily = node.ExtractOwnStyleValue(DocxFontStyle.fontFamily); if (string.IsNullOrEmpty(fontFamily)) { string face = node.ExtractAttributeValue("face"); if (!string.IsNullOrEmpty(face)) { node.SetExtentedStyle(DocxFontStyle.fontFamily, face); } } string fontSize = node.ExtractOwnStyleValue(DocxFontStyle.fontSize); if (string.IsNullOrEmpty(fontSize)) { SetFontSize(node); } string color = node.ExtractOwnStyleValue(DocxColor.color); if(string.IsNullOrEmpty(color)) { color = node.ExtractAttributeValue("color"); if(!string.IsNullOrEmpty(color)) { node.SetExtentedStyle(DocxColor.color, color); } } }
private void ApplyStyle(DocxNode node) { string fontSizeValue = node.ExtractOwnStyleValue(DocxFontStyle.fontSize); string fontWeightValue = node.ExtractOwnStyleValue(DocxFontStyle.fontWeight); if (string.IsNullOrEmpty(fontSizeValue)) { string headingFontSize = CalculateFontSize(GetHeaderNumber(node)); string inheritedStyle = node.ExtractInheritedStyleValue(DocxFontStyle.fontSize); if (!string.IsNullOrEmpty(inheritedStyle)) { fontSizeValue = string.Concat( context.Parser.CalculateRelativeChildFontSize( inheritedStyle, headingFontSize).ToString("G29"), "px"); } else { fontSizeValue = headingFontSize; } } if (string.IsNullOrEmpty(fontWeightValue)) { fontWeightValue = DocxFontStyle.bold; } node.SetExtentedStyle(DocxFontStyle.fontSize, fontSizeValue); node.SetExtentedStyle(DocxFontStyle.fontWeight, fontWeightValue); }
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); }
private void SetFontSize(DocxNode node) { string size = node.ExtractAttributeValue("size"); if (string.IsNullOrEmpty(size)) { return; } Match match = Regex.Match(size, "^\\d+"); Int32 sizeValue; Int32 fontSizeValue = 0; if (!match.Success || !Int32.TryParse(match.Value, out sizeValue)) { return; } if (!fontSizes.TryGetValue(sizeValue, out fontSizeValue)) { if (sizeValue > 7) { fontSizeValue = 48; } } if (fontSizeValue != 0) { node.SetExtentedStyle(DocxFontStyle.fontSize, string.Concat(fontSizeValue.ToString(), "px")); } }
private void SetFontSize(DocxNode node) { string size = node.ExtractAttributeValue("size"); if (string.IsNullOrEmpty(size)) { return; } Match match = Regex.Match(size, "^\\d+"); if (!match.Success || !Int32.TryParse(match.Value, out int sizeValue)) { return; } if (!fontSizes.TryGetValue(sizeValue, out int fontSizeValue)) { if (sizeValue > 7) { fontSizeValue = 48; } } if (fontSizeValue != 0) { node.SetExtentedStyle(DocxFontStyle.fontSize, string.Concat(fontSizeValue.ToString(), "px")); } }
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); }
private void SetThStyleToRun(DocxNode run) { string value = run.ExtractStyleValue(DocxFontStyle.fontWeight); if (string.IsNullOrEmpty(value)) { run.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold); } }
private void SetStyle(DocxNode node) { string value = node.ExtractStyleValue(DocxFontStyle.italic); if (string.IsNullOrEmpty(value)) { node.SetExtentedStyle(DocxFontStyle.fontStyle, DocxFontStyle.italic); } }
void ITextElement.Process(DocxNode node, Dictionary <string, object> properties) { if (IsHidden(node)) { return; } node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold); ProcessTextChild(node, properties); }
void ITextElement.Process(DocxNode node, Dictionary <string, object> properties) { if (IsHidden(node)) { return; } node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center); ProcessTextChild(node, properties); }
void ITextElement.Process(DocxNode node) { if (IsHidden(node)) { return; } node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold); ProcessTextChild(node); }
void ITextElement.Process(DocxNode node) { if (IsHidden(node)) { return; } node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.underLine); ProcessTextChild(node); }
void ITextElement.Process(DocxNode node) { if (IsHidden(node)) { return; } node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center); ProcessTextChild(node); }
void ITextElement.Process(DocxNode node, Dictionary <string, object> properties) { if (IsHidden(node)) { return; } node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.underLine); ProcessTextChild(node, 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, 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, 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) { 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) { 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, 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.underLine); ProcessElement(node, ref paragraph); }
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 void SetLeftMargin(string value) { node.SetExtentedStyle(marginLeft, value); }