public void AddParagraph(string text, int textSize, string font, MyTypographicalEmphasis typoEmp, MyJustification justification) { RunProperties runProp = GetRunProperties(font, textSize, typoEmp); Run run = new Run(runProp, new Text(text)); ParagraphProperties paraProp = new ParagraphProperties(new Justification() { Val = justification == MyJustification.Left ? JustificationValues.Left : justification == MyJustification.Right ? JustificationValues.Right : JustificationValues.Center }); Paragraph paragraph = new Paragraph(paraProp, run); body.AppendChild(paragraph); }
public CellStyle(short[] padding = null, string font = "Times New Roman", int fontSize = 12, MyJustification justification = MyJustification.Left, MyTypographicalEmphasis emphasis = MyTypographicalEmphasis.Normal, short colspan = 1) { Font = font; FontSize = fontSize; Justification = justification; Emphasis = emphasis; Colspan = colspan; if (padding is null) { padding = new short[] { 0, 0, 0, 0 } } ; Padding = padding; } }
private RunProperties GetRunProperties(string font, int fontSize, MyTypographicalEmphasis typoEmp) { RunProperties runProp = new RunProperties( new FontSize() { Val = (fontSize * 2).ToString() }, new RunFonts() { Ascii = font, HighAnsi = font } ); if (typoEmp == MyTypographicalEmphasis.Bold) { runProp.Bold = new Bold(); } return(runProp); }