By: Marco
Date: 2013-03-25
Time: 10:32
|
Create a hyperlink to a fileHello,
is there any way to create a hyperlink to a file while merging a MS Word template? Merging the address with [a.name;block=w:tr] does not work because this leads to %5ba.name;block=w:tr%5d Thanks Marco |
||
By: Sarah
Date: 2013-03-25
Time: 17:16
|
Re: Create a hyperlink to a fileI wouldn't think that creating a hyperlink in a Word template should cause problems. Can you give more context? Where is this tag located - in the main template or a subtemplate? Is the tag located inside of another tag?
|
||
By: Marco
Date: 2013-03-26
Time: 07:55
|
Re: Create a hyperlink to a fileHi Sarah,
The hyperlink will be inside a table in future but first I tried to change one in an empty document. The text changes but the link doesn't because Word replaces [ with %5b after closing the window for creating a hyperlink. Thank you Marco |
||
By: Sarah
Date: 2013-03-26
Time: 16:16
|
Re: Create a hyperlink to a fileAh, I see your problem now. I forget that mostly people build these templates in Word itself - I have been in the XML too long.
I cannot find any way to get Word to not convert certain characters (including [ ] and { }) in the hyperlink input (at least in Word 2007). You can, however, choose different tags for TBS to recognize. For instance, if you use != and =!, Word will not convert them and TBS should be able to use these as long as you have a version >=2.02 and you use:
You would have to change all of the tags in your template for them to work though. You can read about changing markers here: http://www.tinybutstrong.com/support.php#faq_markers FYI, I have not used this functionality. |
||
By: Marco
Date: 2013-03-27
Time: 08:19
|
Re: Create a hyperlink to a fileThank you very much!
Now the %5b is gone and standard tags work as normal. But TBS does not replace the placeholder of the address. How do I make TBS to change the target of the hyperlink? The next problem will be the creation of new relationships, I think.
My php-code:
Thank you! Marco |
||
By: Sarah
Date: 2013-03-27
Time: 16:48
|
Re: Create a hyperlink to a fileWhen you say "standard tags work as normal" do you mean you are still able to use [ and ] style tags when you have $TBS = new clsTinyButStrong('!=,=!'); ?
In my tests, this was not true. Either != =! tags worked, or [ ] tags - not both at once. I am using TBS 3.8.0. If [ and ] tags are still working, there must be something wrong with the new tag selection. What TBS version are you using? |
||
By: Marco
Date: 2013-03-28
Time: 10:25
|
Re: Create a hyperlink to a fileNo, that's not the problem. I've changed every [ ] to != =!.
The point is that the target of the hyperlink
I am using the newest TBS version. Thank you. Marco |
||
By: Sarah
Date: 2013-03-28
Time: 16:30
|
Re: Create a hyperlink to a fileI see now. I'm afraid I have not worked enough with links to help much more, I have not attempted to edit the relationship declarations directly.
It may be necessary to load the word/_rels/document.xml.rels template in addition to your main template to give TBS access to the tag in the Target attribute (I believe that is where relationship information is stored). You can read more about this file here: http://www.phpclasses.org/browse/file/29261.html If you open up your template archive and look at this file and see your tag that is not merging correctly there, I would certainly give load this file as a second template a shot.
(I haven't tried this, it works with xml files in the archive but I don't know about .rels files...) |
||
By: Marco
Date: 2013-04-02
Time: 08:57
|
Re: Create a hyperlink to a fileHi Sarah,
your idea works :) But the block=w:tr-part doesn't because the relationship is not a table. If I leave block=w:tr away, the address is always the same: test.PDF. How can I make it varying? Thank you very much Marco
|
||
By: Sarah
Date: 2013-04-02
Time: 17:09
|
Re: Create a hyperlink to a fileI'm glad we're making progress!
I would try block=relationship, and if that doesn't work, you can always try making your own block boundaries inside the attribute:
I'm sort of regretting my choice of the != =! tags as they are quite confusing to read... but hopefully you see what I am getting at here. You can see an example of this kind of block declaration in the manual ( http://www.tinybutstrong.com/manual.php#html_block ) under 'Explicit Syntax'. |
||
By: Marco
Date: 2013-04-03
Time: 13:32
|
Re: Create a hyperlink to a fileHi!
block=relationship does not work. It currupts the document. Target="!=a;block=begin;=!!=a.name;=!!=a;block=end=!" leads to 3 times test.PDFname02name03. Thank you Marco |
||
By: Sarah
Date: 2013-04-03
Time: 17:34
|
Re: Create a hyperlink to a fileI haven't worked with links but I think they are similar to pictures in that there are two distinct locations that need to be updated and kept in sync and I don't know the best way to access them both within the bounds that Word allows. This seems like something OpenTBS would do for you, but I couldn't find anything in the documentation about hyperlinks. You could try adding something like this in the hyperlink target:
And then make sure you are also using a block to propagate the anchor text and you change the id for that too - you haven't shown the XML for the anchor text so I don't have an example, but you would need something just like the second tags in the target shown above:
Haven't tested this - it's just a starting point. If you end up with a corrupted document, use OpenTBS's $TBS->Show(OPENTBS_DEBUG_XML); to see where the problem is, or take a note of the line and character number Word gives you and extract the .docx manually and look at the xml at that location to see what your problem is. |