Drawings
Png and svg images can be included inline with text using the InlineDrawing
object.
import WriteDocx as W
doc = W.Document(
W.Body([
W.Section([
W.Paragraph([
W.Run([
W.Text("Here's a little inline drawing: "),
W.InlineDrawing(
image = "./../assets/icon_docx.png",
width = 30 * W.pt,
height = 30 * W.pt,
),
]),
]),
]),
]),
)
W.save("inline_drawing.docx", doc)
Download inline_drawing.docx
: