Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Create-an-HTML-table/Groovy/create-an-html-table.groovy
Normal file
20
Task/Create-an-HTML-table/Groovy/create-an-html-table.groovy
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import groovy.xml.MarkupBuilder
|
||||
|
||||
def createTable(columns, rowCount) {
|
||||
def writer = new StringWriter()
|
||||
new MarkupBuilder(writer).table(style: 'border:1px solid;text-align:center;') {
|
||||
tr {
|
||||
th()
|
||||
columns.each { title -> th(title)}
|
||||
}
|
||||
(1..rowCount).each { row ->
|
||||
tr {
|
||||
td(row)
|
||||
columns.each { td((Math.random() * 9999) as int ) }
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.toString()
|
||||
}
|
||||
|
||||
println createTable(['X', 'Y', 'Z'], 3)
|
||||
Loading…
Add table
Add a link
Reference in a new issue