This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Description
After commit #838 fix the bug, I can easily add links to the table.
But today I've had a new error, if I read an file which has any hyperlink, and then save file again, the saved file will have an error:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error895600_18.xml</logFileName><summary>在文件“D:\test-2.xlsx”中检测到错误</summary><repairedParts><repairedPart>已修复的部件: 有 XML 错误的 /xl/worksheets/sheet1.xml。 灾难性故障 行 2,列 823。</repairedPart></repairedParts></recoveryLog>
I simplified the code:
func excelWrite() {
wb := xlsx.NewFile()
sh, er := wb.AddSheet("test")
exitIfError(er)
r := sh.AddRow()
c := r.AddCell()
c.SetHyperlink("http://www.google.com/index.html",
"This is a hyperlink",
"Click on the cell text to follow the hyperlink")
er = wb.Save(`D:\test-1.xlsx`)
exitIfError(er)
}
func excelRead() {
wb, er := xlsx.OpenFile(`D:\test-1.xlsx`)
exitIfError(er)
sh, _ := wb.Sheet["test"]
r, er := sh.Row(0)
exitIfError(er)
c := r.GetCell(0)
fmt.Println(c.Hyperlink)
er = wb.Save(`D:\test-2.xlsx`)
exitIfError(er)
}
func main() {
excelWrite()
excelRead()
}