/// <summary> /// Define font parameters. /// </summary> /// <param name="style"></param> /// <param name="settings"></param> private static void SetFont(Style style, StyleSettingsDefinition settings) { style.Font.Name = settings.FontFamily; style.Font.Size = new Unit(settings.FontSizeInPt, UnitType.Point); style.Font.Color = Colors.Black; switch (settings.FontStyle) { case FontStyleEnum.Bold: style.Font.Bold = true; break; case FontStyleEnum.BoldItalic: style.Font.Bold = true; style.Font.Italic = true; break; case FontStyleEnum.Italic: style.Font.Italic = true; break; case FontStyleEnum.Underline: style.Font.Underline = Underline.Single; break; } }
/// <summary> /// Define text paragraph parameters. /// </summary> /// <param name="style"></param> /// <param name="settings"></param> /// <param name="isTable"></param> private static void SetParagraphStyle(Style style, StyleSettingsDefinition settings, bool isTable) { style.ParagraphFormat.LineSpacing = new Unit(settings.LineSpacingInPt, UnitType.Point); if (!isTable) { style.ParagraphFormat.LineSpacingRule = LineSpacingRule.Exactly; } style.ParagraphFormat.Alignment = settings.HorizontalAlignment.ConvertEnum <MigraDoc.DocumentObjectModel.ParagraphAlignment>(); style.ParagraphFormat.SpaceBefore = new Unit(settings.SpacingBeforeInPt, UnitType.Point); style.ParagraphFormat.SpaceAfter = new Unit(settings.SpacingAfterInPt, UnitType.Point); }