本文整理汇总了C#中RunProperties类的典型用法代码示例。如果您正苦于以下问题:C# RunProperties类的具体用法?C# RunProperties怎么用?C# RunProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RunProperties类属于命名空间,在下文中一共展示了RunProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
internal void Process(Run element, DocxNode node)
{
RunProperties properties = element.RunProperties;
if (properties == null)
{
properties = new RunProperties();
}
//Order of assigning styles to run property is important. The order should not change.
CheckFonts(node, properties);
string color = node.ExtractStyleValue(DocxColor.color);
if (!string.IsNullOrEmpty(color))
{
DocxColor.ApplyColor(color, properties);
}
CheckFontStyle(node, properties);
ProcessBackGround(node, properties);
ProcessVerticalAlign(node, properties);
if (element.RunProperties == null && properties.HasChildren)
{
element.RunProperties = properties;
}
}
示例2: GenerateRun
protected Run GenerateRun(RunProperties runProperties, string text)
{
SetFontRunProperties(runProperties);
var run = new Run() { RunProperties = runProperties };
run.AppendChild(new Text(text));
return run;
}
示例3: ProcessVerticalAlign
private void ProcessVerticalAlign(DocxNode node, RunProperties properties)
{
string verticalAlign = node.ExtractStyleValue(DocxAlignment.verticalAlign);
if(!string.IsNullOrEmpty(verticalAlign))
{
DocxAlignment.ApplyVerticalTextAlign(verticalAlign, properties);
}
}
示例4: SetFontRunProperties
protected void SetFontRunProperties(RunProperties runProperties)
{
runProperties.RunFonts = new RunFonts()
{
Ascii = "Times New Roman"
};
runProperties.FontSize = new FontSize()
{
Val = "24"
};
}
示例5: ProcessBackGround
private void ProcessBackGround(DocxNode node, RunProperties properties)
{
string backgroundColor = node.ExtractStyleValue(DocxColor.backGroundColor);
string backGround = DocxColor.ExtractBackGround(node.ExtractStyleValue(DocxColor.backGround));
if (!string.IsNullOrEmpty(backgroundColor))
{
DocxColor.ApplyBackGroundColor(backgroundColor, properties);
}
else if (!string.IsNullOrEmpty(backGround))
{
DocxColor.ApplyBackGroundColor(backGround, properties);
}
}
示例6: AddParagraph
protected void AddParagraph(Body body, JustificationValues justification, RunProperties runProperties, string text)
{
SetFontRunProperties(runProperties);
var paragraph = body.AppendChild(new Paragraph()
{
ParagraphProperties = new ParagraphProperties()
{
Justification = new Justification() { Val = justification }
}
});
var run = paragraph.AppendChild(new Run() { RunProperties = runProperties });
run.AppendChild(new Text(text));
}
示例7: CreateCodeParagraph
private Paragraph CreateCodeParagraph(CodeVM code)
{
Paragraph paragraph1 = new Paragraph();
ParagraphProperties paragraphProperties1 = new ParagraphProperties();
Indentation indentation1 = new Indentation(){ FirstLine = "210", FirstLineChars = 100 };
paragraphProperties1.Append(indentation1);
Run run1 = new Run();
RunProperties runProperties1 = new RunProperties();
RunFonts runFonts1 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };
runProperties1.Append(runFonts1);
Text text1 = new Text();
text1.Text = code.Value;
run1.Append(runProperties1);
run1.Append(text1);
Run run2 = new Run();
RunProperties runProperties2 = new RunProperties();
RunFonts runFonts2 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };
runProperties2.Append(runFonts2);
TabChar tabChar1 = new TabChar();
run2.Append(runProperties2);
run2.Append(tabChar1);
Run run3 = new Run();
RunProperties runProperties3 = new RunProperties();
RunFonts runFonts3 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };
runProperties3.Append(runFonts3);
Text text2 = new Text();
text2.Text = code.Label;
run3.Append(runProperties3);
run3.Append(text2);
paragraph1.Append(paragraphProperties1);
paragraph1.Append(run1);
paragraph1.Append(run2);
paragraph1.Append(run3);
return paragraph1;
}
示例8: CheckFontStyle
private void CheckFontStyle(DocxNode node, RunProperties properties)
{
string fontSize = node.ExtractStyleValue(DocxFontStyle.fontSize);
string textDecoration = node.ExtractStyleValue(DocxFontStyle.textDecoration);
if (!string.IsNullOrEmpty(fontSize))
{
DocxFontStyle.ApplyFontSize(fontSize, properties);
}
if (!string.IsNullOrEmpty(textDecoration))
{
DocxFontStyle.ApplyTextDecoration(textDecoration, properties);
}
}
示例9: AddAlphaRow
public Paragraph AddAlphaRow()
{
var paragraph1 = new Paragraph {RsidParagraphMarkRevision = "005205ED", RsidParagraphAddition = "00A01149", RsidParagraphProperties = "005205ED", RsidRunAdditionDefault = "00E7001C"};
var paragraphProperties1 = new ParagraphProperties();
var spacingBetweenLines1 = new SpacingBetweenLines {After = "60", Line = "240", LineRule = LineSpacingRuleValues.Auto};
var justification1 = new Justification {Val = JustificationValues.Center};
var paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
var runFonts1 = new RunFonts {ComplexScriptTheme = ThemeFontValues.MinorHighAnsi};
var bold1 = new Bold();
var fontSize1 = new FontSize {Val = "32"};
var fontSizeComplexScript1 = new FontSizeComplexScript {Val = "32"};
paragraphMarkRunProperties1.Append(runFonts1);
paragraphMarkRunProperties1.Append(bold1);
paragraphMarkRunProperties1.Append(fontSize1);
paragraphMarkRunProperties1.Append(fontSizeComplexScript1);
paragraphProperties1.Append(new KeepNext());
paragraphProperties1.Append(spacingBetweenLines1);
paragraphProperties1.Append(justification1);
paragraphProperties1.Append(paragraphMarkRunProperties1);
var run1 = new Run {RsidRunProperties = "005205ED"};
var runProperties1 = new RunProperties();
var runFonts2 = new RunFonts {ComplexScriptTheme = ThemeFontValues.MinorHighAnsi};
var bold2 = new Bold();
var fontSize2 = new FontSize {Val = "32"};
var fontSizeComplexScript2 = new FontSizeComplexScript {Val = "32"};
runProperties1.Append(runFonts2);
runProperties1.Append(bold2);
runProperties1.Append(fontSize2);
runProperties1.Append(fontSizeComplexScript2);
var text1 = new Text();
text1.Text = FamilyName.Substring(0, 1);
run1.Append(runProperties1);
run1.Append(text1);
paragraph1.Append(paragraphProperties1);
paragraph1.Append(run1);
return paragraph1;
}
示例10: ApplyTags
/// <summary>
/// Apply all the current Html tag (Run properties) to the specified run.
/// </summary>
public override void ApplyTags(OpenXmlCompositeElement run)
{
if (tags.Count == 0 && DefaultRunStyle == null) return;
RunProperties properties = run.GetFirstChild<RunProperties>();
if (properties == null) run.PrependChild<RunProperties>(properties = new RunProperties());
var en = tags.GetEnumerator();
while (en.MoveNext())
{
TagsAtSameLevel tagsOfSameLevel = en.Current.Value.Peek();
foreach (OpenXmlElement tag in tagsOfSameLevel.Array)
properties.Append(tag.CloneNode(true));
}
if (this.DefaultRunStyle != null)
properties.Append(new RunStyle() { Val = this.DefaultRunStyle });
}
示例11: ApplyStyle
public static StyleDefinitionsPart ApplyStyle(this StyleDefinitionsPart part, IStyle mystyle)
{
var pRp = new RunProperties();
var color = new Color()
{
Val = mystyle.Color
};
var fonts = new RunFonts
{
Ascii = mystyle.FontName
};
pRp.Append(color);
pRp.Append(fonts);
if (mystyle.Bold)
{
pRp.Append(new Bold());
}
pRp.Append(new FontSize()
{
Val = mystyle.FontSize.ToString()
});
var style = new Style { StyleId = mystyle.Id };
style.Append(new Name() { Val = mystyle.Name });
style.Append(new BasedOn() { Val = mystyle.BasedOn });
style.Append(new NextParagraphStyle() { Val = "Normal" });
style.Append(pRp);
if (part.Styles == null)
{
part.Styles = new Styles();
}
part.Styles.Append(style);
part.Styles.Save();
return part;
}
示例12: CheckFonts
private void CheckFonts(DocxNode node, RunProperties properties)
{
string fontFamily = node.ExtractStyleValue(DocxFontStyle.fontFamily);
string fontWeight = node.ExtractStyleValue(DocxFontStyle.fontWeight);
string fontStyle = node.ExtractStyleValue(DocxFontStyle.fontStyle);
if (!string.IsNullOrEmpty(fontFamily))
{
DocxFontStyle.ApplyFontFamily(fontFamily, properties);
}
if (!string.IsNullOrEmpty(fontWeight))
{
DocxFontStyle.ApplyFontWeight(fontWeight, properties);
}
if (!string.IsNullOrEmpty(fontStyle))
{
DocxFontStyle.ApplyFontStyle(fontStyle, properties);
}
}
示例13: GenerateChapterEight
private void GenerateChapterEight()
{
var paraProp = new ParagraphProperties();
var paragraph = new Paragraph();
var runProp = new RunProperties();
var run = new Run();
var chapterEight = _sessionObjects.ChapterEight;
run.Append(new Text(chapterEight.Header));
paraProp = GetParagraphProperties("Header1");
GenerateParagraph(run, paraProp);
for (var i = 0; i < chapterEight.Provision.Rows.Count; i++)
{
paraProp = GetParagraphProperties("StyleWithoutIndentation");
run = new Run();
var str = String.Format("{0}. {1}", i, chapterEight.Provision.Rows[i]["Text"].ToString());
run.Append(new Text(str));
GenerateParagraph(run, paraProp);
}
GenerateParagraph();
}
示例14: CreateTextContent
protected static IEnumerable<Run> CreateTextContent(IEnumerable<string> content, RunProperties runProperties = null)
{
return content
.SelectMany(x => x.Split(new[] {Environment.NewLine}, StringSplitOptions.None))
.SelectMany((contentLine, index) => index == 0
? new[]
{
new Run(new Text(contentLine) {Space = SpaceProcessingModeValues.Preserve})
{
RunProperties = CloneRunPropertiesIfNotNull(runProperties)
}
}
: new[]
{
new Run(new Break()) {RunProperties = CloneRunPropertiesIfNotNull(runProperties)},
new Run(new Text(contentLine) {Space = SpaceProcessingModeValues.Preserve})
{
RunProperties = CloneRunPropertiesIfNotNull(runProperties)
}
})
.ToList();
}
示例15: CreateRun
private static RunProperties CreateRun(Model.Text text)
{
RunProperties runProperties = new RunProperties();
if (text.Font == null) return null;
FontSize size = new FontSize()
{
Val = Utilities.GetHPSValue(text.Font.Size)
};
runProperties.Append(size);
foreach (var format in text.Font.Formats)
{
switch (format)
{
case Model.FontFormats.Bold: runProperties.Append(new Bold()); break;
case Model.FontFormats.Italic: runProperties.Append(new Italic()); break;
case Model.FontFormats.Underlined: runProperties.Append(new Underline() { Val = UnderlineValues.Single}); break;
}
}
return runProperties;
}