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

add AddShape api

This commit is contained in:
源文雨
2023-02-27 16:12:56 +08:00
parent c8aae913f2
commit d19032acad
11 changed files with 211 additions and 23 deletions

View File

@@ -20,8 +20,14 @@
package docx
import (
"strconv"
"sync/atomic"
)
// addImage add image to docx and return its rId
func (f *Docx) addImage(m Media) string {
func (f *Docx) addImage(format string, data []byte) string {
m := Media{Name: "image" + strconv.Itoa(int(atomic.AddUintptr(&f.imageID, 1))) + "." + format, Data: data}
f.addMedia(m)
return f.addImageRelation(m)
}