test_data/repository/test.data/export.style.go
2024-07-17 15:13:00 +08:00

118 lines
3.6 KiB
Go

package test_data
import "github.com/xuri/excelize/v2"
func NormalSheetStyle(f *excelize.File) int {
style, _ := f.NewStyle(&excelize.Style{
Border: []excelize.Border{
{Type: "left", Color: "000000", Style: 1},
{Type: "top", Color: "000000", Style: 1},
{Type: "bottom", Color: "000000", Style: 1},
{Type: "right", Color: "000000", Style: 1},
},
Fill: excelize.Fill{Type: "pattern", Pattern: 1, Color: []string{}},
Font: &excelize.Font{Family: "微软雅黑", Size: 10, Bold: false},
Alignment: &excelize.Alignment{
Horizontal: "center",
},
})
return style
}
func TitleStyle(f *excelize.File) int {
style, _ := f.NewStyle(&excelize.Style{
Border: []excelize.Border{
{Type: "left", Color: "000000", Style: 1},
{Type: "top", Color: "000000", Style: 1},
{Type: "bottom", Color: "000000", Style: 1},
{Type: "right", Color: "000000", Style: 1},
},
Fill: excelize.Fill{Type: "pattern", Pattern: 1, Color: []string{"#4F81BD"}},
Font: &excelize.Font{Family: "微软雅黑", Size: 10, Bold: false},
Alignment: &excelize.Alignment{
Horizontal: "center",
},
})
return style
}
func ActualLimitStyle(f *excelize.File) int {
style, _ := f.NewStyle(&excelize.Style{
Border: []excelize.Border{
{Type: "left", Color: "000000", Style: 1},
{Type: "top", Color: "000000", Style: 1},
{Type: "bottom", Color: "000000", Style: 1},
{Type: "right", Color: "000000", Style: 1},
},
Fill: excelize.Fill{Type: "pattern", Pattern: 1, Color: []string{"#D0D8E8"}},
Font: &excelize.Font{Family: "微软雅黑", Size: 10, Bold: false},
Alignment: &excelize.Alignment{
Horizontal: "center",
},
})
return style
}
func LimitStyle(f *excelize.File) int {
style, _ := f.NewStyle(&excelize.Style{
Border: []excelize.Border{
{Type: "left", Color: "000000", Style: 1},
{Type: "top", Color: "000000", Style: 1},
{Type: "bottom", Color: "000000", Style: 1},
{Type: "right", Color: "000000", Style: 1},
},
Fill: excelize.Fill{Type: "pattern", Pattern: 1, Color: []string{"#FFF2CC"}},
Font: &excelize.Font{Family: "微软雅黑", Size: 10, Bold: false},
Alignment: &excelize.Alignment{
Horizontal: "center",
},
})
return style
}
func CPMapPassStyle(f *excelize.File) int {
style, _ := f.NewStyle(&excelize.Style{
Border: []excelize.Border{
{Type: "left", Color: "000000", Style: 1},
{Type: "top", Color: "000000", Style: 1},
{Type: "bottom", Color: "000000", Style: 1},
{Type: "right", Color: "000000", Style: 1},
},
Fill: excelize.Fill{Type: "pattern", Pattern: 1, Color: []string{"#4FFF00"}},
Font: &excelize.Font{Family: "微软雅黑", Size: 10, Bold: false},
})
return style
}
func CPMapFailStyle(f *excelize.File) int {
style, _ := f.NewStyle(&excelize.Style{
Border: []excelize.Border{
{Type: "left", Color: "000000", Style: 1},
{Type: "top", Color: "000000", Style: 1},
{Type: "bottom", Color: "000000", Style: 1},
{Type: "right", Color: "000000", Style: 1},
},
Fill: excelize.Fill{Type: "pattern", Pattern: 1, Color: []string{"#FF0000"}},
Font: &excelize.Font{Family: "微软雅黑", Size: 10, Bold: false},
})
return style
}
func NormalNumberSheetStyle(f *excelize.File) int {
style, _ := f.NewStyle(&excelize.Style{
Border: []excelize.Border{
{Type: "left", Color: "000000", Style: 1},
{Type: "top", Color: "000000", Style: 1},
{Type: "bottom", Color: "000000", Style: 1},
{Type: "right", Color: "000000", Style: 1},
},
NumFmt: 2,
Fill: excelize.Fill{Type: "pattern", Pattern: 1, Color: []string{}},
Font: &excelize.Font{Family: "微软雅黑", Size: 10, Bold: false},
Alignment: &excelize.Alignment{
Horizontal: "center",
},
})
return style
}