简体   繁体   中英

How to set relative path for a hyperlink in Excel through Java/groovy

I have a directory there I have one Excel file and one text file. I want to set a hyperlink in my Excel for that text file with relative path. Wherever I can store that directory in my system and that hyperlink should work.

Problem: If I am setting absolute path for the text file in the hyperlink then it creates problem when I change the directory location.

So I want to set a relative path for the hyperlink so wherever I store my directory the hyperlink should work because my both files are stored inside one parent directory.

got the solution String relativePath = "../parentdir/fileToLink.txt";

If this path get set there then its working fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM