diff options
author | Ri Xu <xuri.me@gmail.com> | 2018-02-03 15:02:37 +0800 |
---|---|---|
committer | Ri Xu <xuri.me@gmail.com> | 2018-02-03 15:02:37 +0800 |
commit | 76219275737f28d1b58ac4c693c5e8f59daf53fd (patch) | |
tree | 9ac1d5f8273406b4f16d3bba48d36168f46e242e /excelize_test.go | |
parent | 638bd44dd5940bfcc5921171dc00978f3a24f7e8 (diff) |
- Add a hyperlink to an image support for the function `AddPicture()`, relate issue #185;
- go test and document has been updated.
Diffstat (limited to 'excelize_test.go')
-rw-r--r-- | excelize_test.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/excelize_test.go b/excelize_test.go index c7fb5de..0b7b8bc 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -132,22 +132,22 @@ func TestAddPicture(t *testing.T) { if err != nil { t.Log(err) } - // Test add picture to sheet. - err = xlsx.AddPicture("Sheet2", "I9", "./test/images/excel.jpg", `{"x_offset": 140, "y_offset": 120}`) + // Test add picture to worksheet with offset and location hyperlink. + err = xlsx.AddPicture("Sheet2", "I9", "./test/images/excel.jpg", `{"x_offset": 140, "y_offset": 120, "hyperlink": "#Sheet2!D8", "hyperlink_type": "Location"}`) if err != nil { t.Log(err) } - // Test add picture to sheet with offset. - err = xlsx.AddPicture("Sheet1", "F21", "./test/images/excel.png", `{"x_offset": 10, "y_offset": 10}`) + // Test add picture to worksheet with offset and external hyperlink. + err = xlsx.AddPicture("Sheet1", "F21", "./test/images/excel.png", `{"x_offset": 10, "y_offset": 10, "hyperlink": "https://github.com/360EntSecGroup-Skylar/excelize", "hyperlink_type": "External"}`) if err != nil { t.Log(err) } - // Test add picture to sheet with invalid file path. + // Test add picture to worksheet with invalid file path. err = xlsx.AddPicture("Sheet1", "G21", "./test/images/excel.icon", "") if err != nil { t.Log(err) } - // Test add picture to sheet with unsupport file type. + // Test add picture to worksheet with unsupport file type. err = xlsx.AddPicture("Sheet1", "G21", "./test/Workbook1.xlsx", "") if err != nil { t.Log(err) |