diff options
author | Ri Xu <xuri.me@gmail.com> | 2017-01-22 16:16:03 +0800 |
---|---|---|
committer | Ri Xu <xuri.me@gmail.com> | 2017-01-22 16:16:03 +0800 |
commit | 03234d6a254ea9fca674bf11564e88a5bd4d054f (patch) | |
tree | 159334fb000c95b0f37260f9241ab45c0ce6142a /README.md | |
parent | 4a9b39afc634a2399c4729f4fb47c9f290ab1ee5 (diff) |
Support add picture with offset and scaling.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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) |