set document properties
This commit is contained in:
@@ -9,7 +9,7 @@ It expects that the json input is formatted as an object containing an array of
|
||||
|---------------|---------------|---------------------------|
|
||||
| inputJson | input.json | File path of the input json to process |
|
||||
| outputFilename | output.xlsx | File path of the output file |
|
||||
| worksheetName | Sheet1 | Set the name of the worksheet |
|
||||
| worksheetName | Sheet1 | Set the name of the worksheet, will be truncated to 31 characters |
|
||||
| boldTopRow | true | Sets the top row of the worksheet to bold |
|
||||
| freezeTopRow | true | Freezes the first row of the Excel worksheet |
|
||||
| autofilter | true | Sets the auto filter on the first row |
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/iancoleman/orderedmap"
|
||||
@@ -92,6 +93,15 @@ func main() {
|
||||
fmt.Printf("Error setting sheet name to '%s': %s\n", worksheetName, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Set the document properties
|
||||
err := xlsx.SetDocProps(&excelize.DocProperties{
|
||||
Creator: "json2excel",
|
||||
Created: time.Now().Format(time.RFC3339),
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Printf("Error setting document properties: %s\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Read the json input file
|
||||
|
Reference in New Issue
Block a user