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 |
|
| inputJson | input.json | File path of the input json to process |
|
||||||
| outputFilename | output.xlsx | File path of the output file |
|
| 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 |
|
| boldTopRow | true | Sets the top row of the worksheet to bold |
|
||||||
| freezeTopRow | true | Freezes the first row of the Excel worksheet |
|
| freezeTopRow | true | Freezes the first row of the Excel worksheet |
|
||||||
| autofilter | true | Sets the auto filter on the first row |
|
| autofilter | true | Sets the auto filter on the first row |
|
||||||
|
@@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/iancoleman/orderedmap"
|
"github.com/iancoleman/orderedmap"
|
||||||
@@ -92,6 +93,15 @@ func main() {
|
|||||||
fmt.Printf("Error setting sheet name to '%s': %s\n", worksheetName, err)
|
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
|
// Read the json input file
|
||||||
|
Reference in New Issue
Block a user