1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-08 17:20:26 +08:00

Dump file

This commit is contained in:
Gonzalo Fernandez-Victorio
2021-05-11 12:51:13 +01:00
parent 54bd3d2d4a
commit b219de947c
2 changed files with 9 additions and 5 deletions

View File

@@ -51,9 +51,9 @@ Now trying to read it
We've found a new hyperlink with ref http://google.com and the text google
End of main
```
You can also increase the log level and just dump a specific file. See [getstructure/main](getstructure/main.go)
You can also increase the log level (-logtostderr=true -v=0) and just dump a specific file(-file /tmp/new-file.docx). See [getstructure/main](getstructure/main.go)
```
$ go build -o docxlib ./getstructure/ && ./docxlib -logtostderr=true -v=0
$ go build -o docxlib ./getstructure/ && ./docxlib -logtostderr=true -v=0 -file /tmp/new-file.docx
I0511 12:37:40.898493 18466 unpack.go:69] Relations: [...]
I0511 12:37:40.898787 18466 unpack.go:47] Doc: [...]
I0511 12:37:40.899330 18466 unpack.go:58] Paragraph [0xc000026d40 0xc000027d00 0xc000172340]

View File

@@ -9,12 +9,16 @@ import (
"github.com/gonfva/docxlib"
)
const FILE_PATH = "/tmp/new-file.docx"
var fileLocation *string
func init() {
fileLocation = flag.String("file", "/tmp/new-file.docx", "file location")
flag.Parse()
}
func main() {
flag.Parse()
//Now let's try to read the file
readFile, err := os.Open(FILE_PATH)
readFile, err := os.Open(*fileLocation)
if err != nil {
panic(err)
}