Skip to content

Commit

Permalink
set font name, fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr committed Oct 15, 2015
1 parent 79a7c1b commit 3abfdef
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
id 'org.asciidoctor.gradle.asciidoctor' version '1.5.1'
}

String currentVersion = '0.1.9'
String currentVersion = '0.1.10'

version = currentVersion

Expand Down
Binary file modified docs/images/fonts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ image:borders.png[]

=== Fonts

You can customize the font size and color of the text in the cell. You also can make it `bold`, `italic`, `underline` or
You can customize the font size, name and color of the text in the cell. You also can make it `bold`, `italic`, `underline` or
`strikeout`. See <<Available predefined colors>>.

[source,groovy]
Expand All @@ -609,10 +609,11 @@ row {
}
cell {
width auto
value 'Underline'
value 'Underline Courier New'
style {
font {
underline
name 'Courier New'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public interface Font extends ProvidesHTMLColors {
void color(Color color);

void size(int size);
void name(String name);

Object getItalic();
Object getBold();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ class PoiFont extends AbstractHTMLColorProvider implements Font {
font.setFontHeightInPoints(size.shortValue())
}

@Override
void name(String name) {
font.setFontName(name)
}

@Override
Object getItalic() {
font.italic = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,50 @@ class PoiExcelBuilderSpec extends Specification {
}
}

sheet('Fonts') {
row {
cell {
width auto
value 'Bold Red 22'
style {
font {
bold
color red
size 22
}
}
}
cell {
width auto
value 'Underline Courier New'
style {
font {
underline
name 'Courier New'
}
}
}
cell {
width auto
value 'Italic'
style {
font {
italic
}
}
}
cell {
width auto
value 'Strikeout'
style {
font {
strikeout
}
}
}
}
}

sheet('Rich Text') {
row {
cell {
Expand All @@ -54,6 +98,7 @@ class PoiExcelBuilderSpec extends Specification {
text 'Red', {
color red
size 22
name "Times New Roman"
}
text ' '
text 'Riding', {
Expand Down Expand Up @@ -123,7 +168,7 @@ class PoiExcelBuilderSpec extends Specification {
}
}

sheet('Cell Adressing') {
sheet('Cell Addressing') {
row(2) {
style {
background whiteSmoke
Expand Down

0 comments on commit 3abfdef

Please sign in to comment.