1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-12 11:40:28 +08:00

add font to run

This commit is contained in:
源文雨
2023-02-26 19:53:36 +08:00
parent f3265280e3
commit e57b2b9ace
4 changed files with 68 additions and 3 deletions

View File

@@ -58,7 +58,20 @@ func (r *Run) Italic() *Run {
return r
}
// Underline ...
// Underline has several possible values including
//
// none: Specifies that no underline should be applied.
// single: Specifies a single underline.
// words: Specifies that only words within the text should be underlined.
// double: Specifies a double underline.
// thick: Specifies a thick underline.
// dotted: Specifies a dotted underline.
// dash: Specifies a dash underline.
// dotDash: Specifies an alternating dot-dash underline.
// dotDotDash: Specifies an alternating dot-dot-dash underline.
// wave: Specifies a wavy underline.
// dashLong: Specifies a long dash underline.
// wavyDouble: Specifies a double wavy underline.
func (r *Run) Underline(val string) *Run {
r.RunProperties.Underline = &Underline{Val: val}
return r
@@ -75,3 +88,13 @@ func (r *Run) AddTab() *Run {
r.Children = append(r.Children, &Tab{})
return r
}
// Font sets the font of the run
func (r *Run) Font(ascii, hansi, hint string) *Run {
r.RunProperties.Fonts = &RunFonts{
Ascii: ascii,
HAnsi: hansi,
Hint: hint,
}
return r
}