Xlsx2Go
package main
import (
"github.com/plandem/xlsx"
"github.com/plandem/xlsx/format/conditional"
"github.com/plandem/xlsx/format/conditional/rule"
"github.com/plandem/xlsx/format/styles"
)
func main() {
xl := xlsx.New()
defer xl.Close()
sheet := xl.AddSheet("The first sheet")
cell := sheet.CellByRef("A2")
cell.SetValue("Easy Peasy")
cell.SetStyles(styles.New(
styles.Font.Bold,
styles.Font.Color("#ff0000"),
styles.Fill.Type(styles.PatternTypeSolid),
styles.Fill.Color("#ffff00"),
styles.Border.Color("#009000"),
styles.Border.Type(styles.BorderStyleMedium),
))
cell.SetComment("No Comment!")
sheet.CellByRef("A4").SetValueWithHyperlink("wikipedia", "http://google.com")
sheet.RangeByRef("A6:A7").Merge()
sheet.CellByRef("A6").SetValue("merged cell")
for iRow := 1; iRow < 7; iRow++ {
cell := sheet.Cell(1, iRow)
cell.SetValue(iRow)
}
sheet.AddConditional(conditional.New(
conditional.AddRule(
rule.Value.Between(1, 3, styles.New(
styles.Font.Bold,
styles.Font.Color("#ff0000"),
)),
),
conditional.AddRule(
rule.IconSet.Type(rule.IconSetType3Arrows),
),
), "B2:B7")
xl.SaveAs("./foo.xlsx")
}
Documentation
Roadmap
Contribution
- To prevent mess, sources have strict separation of markup and functionality. Document that describes OOXML is quite huge (about 6K pages), but the same time - functionality is not.
- All markup resides inside of 'ml' folders, only marshal/unmarshal is allowed here, no any functionality.
- Not every 'ml object' has related 'functional object' and vice versa.
- If you want some functionality, then wrap 'ml object' and do what you want.
OOXML edition
XML is compliant with part 1 of the 5th edition of the ECMA-376 Standard for Office Open XML
License