1 回答
TA贡献1828条经验 获得超6个赞
请执行下列操作:
git clone --depth 1 git://github.com/unidoc/unioffice
New-Item -ItemType Directory unioffice/document/merge
Set-Location unioffice/document/merge
git pull origin pull/448/head
然后在文件夹中,创建以下文件:merge
package main
import (
"github.com/unidoc/unioffice/document"
"os"
"path/filepath"
)
func main() {
s := "TestDocument.docx"
doc0, e := document.Open(s)
if e != nil {
panic(e)
}
defer doc0.Close()
doc1, e := document.Open(s)
if e != nil {
panic(e)
}
defer doc1.Close()
doc0.AddParagraph().AddRun().AddPageBreak()
if e := doc0.Append(doc1); e != nil {
panic(e)
}
out := filepath.Join(os.TempDir(), "merged.docx")
doc0.SaveToFile(out)
}
请注意,这仅用于测试,对于实际代码,您将需要获得许可证。
https://github.com/unidoc/unioffice
- 1 回答
- 0 关注
- 62 浏览
添加回答
举报