From 03234d6a254ea9fca674bf11564e88a5bd4d054f Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Sun, 22 Jan 2017 16:16:03 +0800 Subject: Support add picture with offset and scaling. --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index f9ead95..0346fe8 100644 --- a/README.md +++ b/README.md @@ -114,13 +114,21 @@ package main import ( "fmt" "os" + _ "image/gif" + _ "image/jpeg" + _ "image/png" "github.com/Luxurioust/excelize" ) func main() { xlsx := excelize.CreateFile() - err := xlsx.AddPicture("Sheet1", "A2", "H9", "/tmp/image.jpg") + // Insert a picture. + err := xlsx.AddPicture("Sheet1", "A2", "/tmp/image1.jpg", 0, 0, 1, 1) + // Insert a picture to sheet with scaling. + err = xlsx.AddPicture("Sheet1", "D2", "/tmp/image1.png", 0, 0, 0.5, 0.5) + // Insert a picture offset in the cell. + err = xlsx.AddPicture("Sheet1", "H2", "/tmp/image3.gif", 15, 10, 1, 1) if err != nil { fmt.Println(err) os.Exit(1) -- cgit v1.2.1