mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-27 14:40:24 +08:00
Dump file
This commit is contained in:
@@ -51,9 +51,9 @@ Now trying to read it
|
|||||||
We've found a new hyperlink with ref http://google.com and the text google
|
We've found a new hyperlink with ref http://google.com and the text google
|
||||||
End of main
|
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.898493 18466 unpack.go:69] Relations: [...]
|
||||||
I0511 12:37:40.898787 18466 unpack.go:47] Doc: [...]
|
I0511 12:37:40.898787 18466 unpack.go:47] Doc: [...]
|
||||||
I0511 12:37:40.899330 18466 unpack.go:58] Paragraph [0xc000026d40 0xc000027d00 0xc000172340]
|
I0511 12:37:40.899330 18466 unpack.go:58] Paragraph [0xc000026d40 0xc000027d00 0xc000172340]
|
||||||
|
|||||||
@@ -9,12 +9,16 @@ import (
|
|||||||
"github.com/gonfva/docxlib"
|
"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() {
|
func main() {
|
||||||
flag.Parse()
|
|
||||||
//Now let's try to read the file
|
//Now let's try to read the file
|
||||||
readFile, err := os.Open(FILE_PATH)
|
readFile, err := os.Open(*fileLocation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user