本文整理汇总了Golang中github.com/tealeg/xlsx.Cell.SetFloat方法的典型用法代码示例。如果您正苦于以下问题:Golang Cell.SetFloat方法的具体用法?Golang Cell.SetFloat怎么用?Golang Cell.SetFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tealeg/xlsx.Cell
的用法示例。
在下文中一共展示了Cell.SetFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: writesheet
func writesheet(project *lair.Project, outfile string) {
header := []string{
"#",
"Title",
"CVSS",
"Rating",
"Description",
"Evidence",
"Solution",
"CVEs",
"References",
"Host",
"Hostname(s)",
"Port",
"Service Note",
"Issue Note(s)",
}
var file *xlsx.File
var sheet *xlsx.Sheet
var row *xlsx.Row
var cell *xlsx.Cell
file = xlsx.NewFile()
sheet, err := file.AddSheet(project.Name)
if err != nil {
log.Printf(err.Error())
}
row = sheet.AddRow()
for _, h := range header {
cell = row.AddCell()
cell.Value = h
}
for count, issue := range project.Issues {
var issuenote string
for _, note := range issue.Notes {
issuenote += note.Title
issuenote += note.Content + "\n"
}
for _, host := range issue.Hosts {
var refs []string
for _, ref := range issue.References {
refs = append(refs, ref.Link)
}
row = sheet.AddRow()
cell = row.AddCell()
cell.SetInt(count + 1)
cell = row.AddCell()
cell.Value = issue.Title
cell = row.AddCell()
cell.SetFloat(issue.CVSS)
cell = row.AddCell()
cell.Value = issue.Rating
cell = row.AddCell()
cell.Value = issue.Description
cell = row.AddCell()
cell.Value = issue.Evidence
cell = row.AddCell()
cell.Value = issue.Solution
cell = row.AddCell()
cell.Value = strings.Join(issue.CVEs, "\n")
cell = row.AddCell()
cell.Value = strings.Join(refs, "\n")
cell = row.AddCell()
cell.Value = host.IPv4
cell = row.AddCell()
cell.Value = gethostname(host.IPv4, &project.Hosts)
cell = row.AddCell()
cell.SetInt(host.Port)
cell = row.AddCell()
cell.Value = getcomment(&project.Hosts, issue.Title, host.IPv4, host.Port)
cell = row.AddCell()
cell.Value = issuenote
}
}
err = file.Save(outfile)
if err != nil {
log.Fatal("Fatal: Unable to write file")
}
}