Must admit that I am not 100% certain, but I would say that you will have to
write code to iterate through the hyperlinks and correct them.
It may be worthwhile seeing if it is possible to create hyperlinks that can
modify themselves so to speak when the user opens the worksheet. I guess
that what I am getting at is, is there some form of notation that will
instruct Excel to insert the name of the active workbook into the hyperlink
at run time? Of of the top of my head, you may be able to use the defined
names option - possibly by defining names that refer to specific locations
in a workbook which I am hoping will not be 'corrupted' when you create a
new file based on the template. Myself, I am not enough of an Excel expert
to answer this question but feel it could be worth your time to have a dig
around before writing all of the POI code.
Aram Mirzadeh-2 wrote:
>
> Hi,
>
> I have a xls file with a ton of internal hyperlinks (one cell to
> another) or from sheet to sheet.
>
> I'm using this file as a "template" in my code, so the first thing I do
> is duplicate the workbook and than go ahead and fill in what I need using:
>
> POIFSFileSystem fs = null;
> FileOutputStream output=new FileOutputStream(inputExcelDir +
> inputExcelFileName);
> HSSFWorkbook wb = null;
>
> try {
> fs = new POIFSFileSystem(new FileInputStream(outputExcelDir
> + outputExcelFileName));
> wb = new HSSFWorkbook(fs);
> } catch (Exception e) {
> System.err.println("ERROR: " + e);
> }
>
> wb.write(output);
> output.close();
>
> But now I'm seeing that all of the hyperlinks are broken, as they point
> back to the template file. My question is, is there an easy way to fix
> this or do I need to write a method to go through even sheet, every row,
> every cell and check to see if a hyperlink exists, and if it exists,
> modify it if its internal?
>
> Thanks.
>
> Aram
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/Duplicating-a-workbook-with-internal-links---which-become-broken-tp23930374p23938060.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]