gomutex/godocx

About the method of inserting pictures in the table

Closed this issue · 2 comments

Hello, can you add a method to insert pictures in the table? Thank you

You can use the version v0.1.5 (or above). You can add empty paragraph and add the picture .

Example code

table := document.AddTable()
// Predefined style in the document template
table.Style("LightList-Accent3")

// Insert in Table
tblRow := table.AddRow()
cell00 := tblRow.AddCell()
cell00.AddParagraph("Column1")
cell01 := tblRow.AddCell()
cell01.AddParagraph("Column2")

tblRow1 := table.AddRow()
cell10 := tblRow1.AddCell()
cell10.AddParagraph("Row2 - Column 1")
cell11 := tblRow1.AddCell()
p2 := cell11.AddEmptyPara()
p2.AddPicture("gopher.png", units.Inch(1), units.Inch(1))

ok,thanks 👍🏻