1 回答

TA貢獻1828條經(jīng)驗 獲得超6個贊
請執(zhí)行下列操作:
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
然后在文件夾中,創(chuàng)建以下文件: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 關(guān)注
- 79 瀏覽
添加回答
舉報