summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2017-01-22 16:16:03 +0800
committerRi Xu <xuri.me@gmail.com>2017-01-22 16:16:03 +0800
commit03234d6a254ea9fca674bf11564e88a5bd4d054f (patch)
tree159334fb000c95b0f37260f9241ab45c0ce6142a /README.md
parent4a9b39afc634a2399c4729f4fb47c9f290ab1ee5 (diff)
Support add picture with offset and scaling.
Diffstat (limited to 'README.md')
-rw-r--r--README.md10
1 files changed, 9 insertions, 1 deletions
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)