Sorry to say this but I cannot re-produce the problem. I simply created this
small test class;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.hssf.usermodel.*;
import java.io.*;
/**
*
* @author M8ark Beardsley
*/
public class HyperlinkTest {
public HyperlinkTest() {
File file = null;
FileOutputStream fos = null;
Workbook workbook = null;
Sheet sheet = null;
Row row = null;
Cell cell = null;
Hyperlink hyperlink = null;
try {
workbook = new HSSFWorkbook();
sheet = workbook.createSheet("Hyperlink Test");
row = sheet.createRow(0);
cell = row.createCell(0);
hyperlink =
workbook.getCreationHelper().createHyperlink(Hyperlink.LINK_URL);
hyperlink.setAddress("[Validation Examples.xls]Data
Validation!B1");
cell.setHyperlink(hyperlink);
file = new File("C:/temp/Hyperlink Test.xls");
fos = new FileOutputStream(file);
workbook.write(fos);
}
catch(IOException ioEx) {
HyperlinkTest.printException(ioEx);
}
finally {
if(fos != null) {
try {
fos.close();
fos = null;
}
catch(IOException ioEx) {
HyperlinkTest.printException(ioEx);
}
}
}
}
private static final void printException(Exception ex) {
System.out.println("Caught a: " + ex.getClass().getName());
System.out.println("Message: " + ex.getMessage());
System.out.println("Stacktrace follows:.....");
ex.printStackTrace(System.out);
}
}
..and when I open the generated file, I do see the address of the file
mirrored correctly in the cell. That is to say that none of the characters I
included in the String passed to the setAddress() method were altered at
all.
Sorry I cannot be of more help but I dod suspect that something else may be
at work here.
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/Trouble-with-HyperLink-to-another-cell-in-another-wokbook-tp5603614p5604358.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]