本文整理汇总了C#中TableCell.FontSize方法的典型用法代码示例。如果您正苦于以下问题:C# TableCell.FontSize方法的具体用法?C# TableCell.FontSize怎么用?C# TableCell.FontSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableCell
的用法示例。
在下文中一共展示了TableCell.FontSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRow
public static void AddRow(this Table table, string[] cells, string[] styles = null, bool singleSpace = true)
{
TableRow tr = new TableRow();
for (int i = 0; i < cells.Length; i++)
{
TableCell tc = new TableCell();
if(cells[i].Contains("|"))
{
Paragraph para = tc.AppendChild(new Paragraph(new ParagraphProperties()));
Run run = para.AppendChild(new Run(new RunProperties()));
string[] values = cells[i].Split('|');
for(int j = 0, jj = values.Length; j < jj; j++)
{
if(j != 0)
run.AppendChild(new Break());
run.AppendChild(new Text(values[j]));
}
}
else
tc.AppendChild(new Paragraph(new ParagraphProperties(), new Run(new RunProperties(), new Text(cells[i]))));
tr.Append(tc);
foreach (OpenXmlElement els in tc.Elements())
{
if (els.GetType() == typeof(Paragraph))
{
Paragraph para = (Paragraph)els;
if(singleSpace)
para.ParagraphProperties.AppendChild(new SpacingBetweenLines() { Line = "240", LineRule = LineSpacingRuleValues.Auto, Before = "0", After = "0" });
else
para.ParagraphProperties.AppendChild(new SpacingBetweenLines() { Line = "240", LineRule = LineSpacingRuleValues.Auto, Before = "240", After = "0" });
}
}
if (styles != null && styles.Length > i && !string.IsNullOrEmpty(styles[i]))
{
TableCellProperties props = new TableCellProperties();
tc.Append(props);
if (styles[i].Contains("LeftIndent"))
{
string value = styles[i].Substring(styles[i].IndexOf("LeftIndent:") + 11);
if (value.Contains("|"))
value = value.Substring(0, value.IndexOf("|"));
props.LeftIndent(value);
}
if (styles[i].Contains("RightIndent"))
{
string value = styles[i].Substring(styles[i].IndexOf("RightIndent:") + 12);
if (value.Contains("|"))
value = value.Substring(0, value.IndexOf("|"));
props.RightIndent(value);
}
if (styles[i].Contains("TopIndent"))
{
string value = styles[i].Substring(styles[i].IndexOf("TopIndent:") + 10);
if (value.Contains("|"))
value = value.Substring(0, value.IndexOf("|"));
props.TopIndent(value);
}
if (styles[i].Contains("Background"))
{
string value = styles[i].Substring(styles[i].IndexOf("Background:") + 11);
if (value.Contains("|"))
value = value.Substring(0, value.IndexOf("|"));
props.BackgroundColor(value);
}
if (styles[i].Contains("Bold"))
tc.Bold();
if (styles[i].Contains("JustifyRight"))
tc.Right();
if (styles[i].Contains("JustifyCenter"))
tc.Center();
if(styles[i].Contains("FontSize"))
{
string value = styles[i].Substring(styles[i].IndexOf("FontSize:") + 9);
if (value.Contains("|"))
value = value.Substring(0, value.IndexOf("|"));
tc.FontSize(value);
}
if (styles[i].Contains("FontColor"))
{
string value = styles[i].Substring(styles[i].IndexOf("FontColor:") + 10);
if (value.Contains("|"))
value = value.Substring(0, value.IndexOf("|"));
tc.FontColor(value);
}
if (styles[i].Contains("VerticalText"))
{
string value = styles[i].Substring(styles[i].IndexOf("VerticalText:") + 13);
if (value.Contains("|"))
value = value.Substring(0, value.IndexOf("|"));
props.VerticalText(value);
}
if (styles[i].Contains("Borders"))
{
string value = styles[i].Substring(styles[i].IndexOf("Borders:") + 8);
if (value.Contains("|"))
value = value.Substring(0, value.IndexOf("|"));
//.........这里部分代码省略.........