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

add api LoadBodyItems

This commit is contained in:
源文雨
2023-03-10 13:28:25 +08:00
parent 45efdb3378
commit daf7190ea6
2 changed files with 54 additions and 3 deletions

View File

@@ -223,9 +223,10 @@ func main() {
}
}
if *splitre != "" {
i := strings.LastIndex(*fileLocation, "/")
for j, splitteddoc := range doc.SplitByParagraph(docx.SplitDocxByPlainTextRegex(regexp.MustCompile(*splitre))) {
name := (*fileLocation)[:i+1] + "unmarshal_split" + strconv.Itoa(j) + "_" + (*fileLocation)[i+1:]
a := strings.LastIndex(*fileLocation, "/")
b := strings.LastIndex(*fileLocation, ".")
for i, splitteddoc := range doc.SplitByParagraph(docx.SplitDocxByPlainTextRegex(regexp.MustCompile(*splitre))) {
name := (*fileLocation)[:a+1] + "unmarshal_" + (*fileLocation)[a+1:b] + "_split" + strconv.Itoa(i) + (*fileLocation)[b:]
f, err := os.Create(name)
if err != nil {
panic(err)