Compare commits

..

No commits in common. "a1c4002c5ad58d0a8e772d36c2ed4b29f619a2dd" and "0ee7abdf5d2923791f7c968de5c08655edfa1516" have entirely different histories.

3 changed files with 19 additions and 35 deletions

2
golang/.gitignore vendored
View File

@ -1,2 +0,0 @@
fusion.exe
fusion.doc

View File

@ -1,15 +0,0 @@
all: run
run: fusion.doc
fusion.doc: key.txt
UNIDOC_LICENSE_API_KEY=$(shell cat key.txt) go run .
build: fusion.exe
fusion.exe: key.txt
env UNIDOC_LICENSE_API_KEY=$(shell cat key.txt) GOOS=windows GOARCH=amd64 go build .
clean:
rm -f ./fusion.doc
rm -f ./fusion.exe

View File

@ -10,15 +10,15 @@ import (
"gioui.org/app" "gioui.org/app"
"gioui.org/font/gofont" "gioui.org/font/gofont"
"gioui.org/layout"
"gioui.org/op" "gioui.org/op"
"gioui.org/text" "gioui.org/text"
"gioui.org/layout"
"gioui.org/unit" "gioui.org/unit"
"gioui.org/widget" "gioui.org/widget"
"gioui.org/widget/material" "gioui.org/widget/material"
"github.com/unidoc/unioffice/common/license"
"github.com/unidoc/unioffice/document" "github.com/unidoc/unioffice/document"
"github.com/unidoc/unioffice/common/license"
) )
func init() { func init() {
@ -92,7 +92,7 @@ func fusionnerDocx(dossier string) {
} }
for _, fichier := range fichiers { for _, fichier := range fichiers {
if filepath.Ext(fichier.Name()) == ".docx" { if filepath.Ext(fichier.Name()) == ".doc" {
cheminFichier := filepath.Join(dossier, fichier.Name()) cheminFichier := filepath.Join(dossier, fichier.Name())
doc, err := document.Open(cheminFichier) doc, err := document.Open(cheminFichier)
if err != nil { if err != nil {
@ -102,12 +102,12 @@ func fusionnerDocx(dossier string) {
for _, para := range doc.Paragraphs() { for _, para := range doc.Paragraphs() {
newPara := docFusionne.AddParagraph() newPara := docFusionne.AddParagraph()
// newPara.Properties().SetAlignment(para.Properties().Alignment()) // newPara.Properties().SetAlignment(para.Properties().Alignment())
for _, run := range para.Runs() { for _, run := range para.Runs() {
newRun := newPara.AddRun() newRun := newPara.AddRun()
newRun.Properties().SetBold(run.Properties().IsBold()) newRun.Properties().SetBold(run.Properties().IsBold())
newRun.Properties().SetItalic(run.Properties().IsItalic()) newRun.Properties().SetItalic(run.Properties().IsItalic())
// newRun.Properties().SetUnderline(run.Properties().IsUnderline()) // newRun.Properties().SetUnderline(run.Properties().IsUnderline())
newRun.AddText(run.Text()) newRun.AddText(run.Text())
} }
} }
@ -123,3 +123,4 @@ func fusionnerDocx(dossier string) {
fmt.Printf("Documents fusionnés dans %s\n", nomFichierSortie) fmt.Printf("Documents fusionnés dans %s\n", nomFichierSortie)
} }