updated logging
This commit is contained in:
@@ -85,6 +85,10 @@ func main() {
|
|||||||
|
|
||||||
// Assume that our content is within the first top-level key
|
// Assume that our content is within the first top-level key
|
||||||
topLevel := o.Keys()
|
topLevel := o.Keys()
|
||||||
|
fmt.Printf("Found %d top-level keys in json data\n", len(topLevel))
|
||||||
|
for i, key := range topLevel {
|
||||||
|
fmt.Printf("[%d] : %s\n", i, key)
|
||||||
|
}
|
||||||
|
|
||||||
// Check for config embedded in json
|
// Check for config embedded in json
|
||||||
if strings.EqualFold(topLevel[0], configNode) && len(topLevel) > 1 {
|
if strings.EqualFold(topLevel[0], configNode) && len(topLevel) > 1 {
|
||||||
@@ -398,13 +402,12 @@ func modifyWorkbook(worksheetName string, outputFilename string) *excelize.File
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createHeadingRow(xlsx *excelize.File, worksheetName string, columnNames []string) {
|
func createHeadingRow(xlsx *excelize.File, worksheetName string, columnNames []string) {
|
||||||
fmt.Printf("Creating excel workbook with following headings : '%v'\n", columnNames)
|
|
||||||
var cell string
|
var cell string
|
||||||
row := 1
|
row := 1
|
||||||
column := 1
|
column := 1
|
||||||
|
|
||||||
if len(config.keyOrder) > 0 {
|
if len(config.keyOrder) > 0 {
|
||||||
fmt.Printf("Setting heading order as per config key-order\n")
|
fmt.Printf("Creating excel workbook with heading order as per config key-order\n")
|
||||||
// Check that the number of specified columns matches input data
|
// Check that the number of specified columns matches input data
|
||||||
if len(config.keyOrder) != len(columnNames) {
|
if len(config.keyOrder) != len(columnNames) {
|
||||||
error := fmt.Sprintf("Column order specified in json key-order but mismatch found in json data. %d specifed columns does not match %d found columns.", len(config.keyOrder), len(columnNames))
|
error := fmt.Sprintf("Column order specified in json key-order but mismatch found in json data. %d specifed columns does not match %d found columns.", len(config.keyOrder), len(columnNames))
|
||||||
@@ -419,6 +422,7 @@ func createHeadingRow(xlsx *excelize.File, worksheetName string, columnNames []s
|
|||||||
column++
|
column++
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
fmt.Printf("Creating excel workbook with following headings : '%v'\n", columnNames)
|
||||||
// Add the header row
|
// Add the header row
|
||||||
for i := 0; i < len(columnNames); i++ {
|
for i := 0; i < len(columnNames); i++ {
|
||||||
cell, _ = excelize.CoordinatesToCellName(column, row)
|
cell, _ = excelize.CoordinatesToCellName(column, row)
|
||||||
|
Reference in New Issue
Block a user