Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: zip: not a valid zip file #27

Open
yingjunxu opened this issue Mar 23, 2023 · 0 comments
Open

panic: zip: not a valid zip file #27

yingjunxu opened this issue Mar 23, 2023 · 0 comments

Comments

@yingjunxu
Copy link

package main

import (
"fmt"

"github.com/nguyenthenguyen/docx"

)

func main() {

// Read from docx file
r, err := docx.ReadDocxFile("./a.docx")
// Or read from memory
// r, err := docx.ReadDocxFromMemory(data io.ReaderAt, size int64)

// Or read from a filesystem object:
// r, err := docx.ReadDocxFromFS(file string, fs fs.FS)

if err != nil {
	fmt.Println("----")
	panic(err)
	fmt.Println("====")
}
docx1 := r.Editable()
// Replace like https://golang.org/pkg/strings/#Replace
docx1.Replace("OS_CPU", "OK", -1)

docx1.WriteToFile("./a.docx")

r.Close()

}

PS D:\Go\src\testdoc> go run .\testdoc.go

panic: zip: not a valid zip file

goroutine 1 [running]:
main.main()
D:/Go/src/testdoc/testdoc.go:21 +0x1a5
exit status 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant