From 76219275737f28d1b58ac4c693c5e8f59daf53fd Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Sat, 3 Feb 2018 15:02:37 +0800 Subject: - Add a hyperlink to an image support for the function `AddPicture()`, relate issue #185; - go test and document has been updated. --- excelize_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'excelize_test.go') 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) -- cgit v1.2.1