예제 #1
0
func (e *Goexcel) CopyStyle(oldkey string, newkey string) {
	sold := e.Style[oldkey]
	if sold.Font.Name == "" {
		panic("Style " + oldkey + " not found or Font Name not defined")
	}
	style := new(xlsx.Style)
	style.Alignment = sold.Alignment
	style.ApplyAlignment = sold.ApplyAlignment
	style.ApplyBorder = sold.ApplyBorder
	style.ApplyFill = sold.ApplyFill
	style.ApplyFont = sold.ApplyFont
	style.Border = sold.Border
	style.Fill = sold.Fill
	style.Font = sold.Font
	e.Style[newkey] = style
}
예제 #2
0
func setBorderSub(style *xlsx.Style, border string,
	borderPattern string) {
	if len(border) > 0 {
		style.ApplyBorder = true
	}
	border = strings.ToUpper(border)
	if strings.Contains(border, "T") {
		style.Border.Top = borderPattern
	}
	if strings.Contains(border, "B") {
		style.Border.Bottom = borderPattern
	}
	if strings.Contains(border, "R") {
		style.Border.Right = borderPattern
	}
	if strings.Contains(border, "L") {
		style.Border.Left = borderPattern
	}
}