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

inline drawing add Size

This commit is contained in:
源文雨
2023-02-21 13:45:40 +08:00
parent 585ee6cda8
commit 2b5d237bc2
6 changed files with 52 additions and 77 deletions

View File

@@ -95,3 +95,15 @@ func (p *Paragraph) AddInlineDrawingFrom(file string) (*Run, error) {
}
return p.AddInlineDrawing(data)
}
// Size of the inline drawing by EMU
func (in *WPInline) Size(w, h int) {
if in.Extent != nil {
in.Extent.CX = w
in.Extent.CY = h
}
if in.Graphic != nil && in.Graphic.GraphicData != nil && in.Graphic.GraphicData.Pic != nil && in.Graphic.GraphicData.Pic.SpPr != nil {
in.Graphic.GraphicData.Pic.SpPr.Xfrm.Ext.CX = w
in.Graphic.GraphicData.Pic.SpPr.Xfrm.Ext.CY = h
}
}