none
Indicate a hyperlink in a text string for automatic conversion RRS feed

  • Question

  • HI,

    I'm writing a small application using Word automation in order to generate a report.
    After reading the article mentioned above ("Automating Word Tables for Data Insertion and Extraction"),a nd implementing the "Conver to table" approach i'm bump into a new problem:
    In some cells in the table there should be a hyper link to different location in the report documnet, So after converting the delimited string to a table, i need to iterate over the cells and convert some of them to a hyper link text.

    My question is:
    Is there any text format I can use (in the delimited string) that Word automaticly recognise the text as hyper link when converting to a table?

    • Split by Cindy Meister MVPModerator Monday, August 1, 2011 2:03 PM split for better visibility from the answered thread http://social.msdn.microsoft.com/Forums/en-US/worddev/thread/eada6eb5-2763-4ee3-844b-9b95759616f2#34c8777a-2c67-4aba-acb3-5f0b5fadd217
    Monday, August 1, 2011 1:58 PM

Answers

  • Hi Eyal

    I've split your question off into a new thread to make it more visible. It's always chancey, hoping to get a discussion from a much older thread that was answered some time ago. Especially when the question is a spin-off from the discussion, rather than involved with the original topic :-)

    There's nothing you can put into a string that will have Word automatically apply some kind of formatting or other conversion change. This applies to RTF, HTML or even Word's own XML vocabulary. What's written to a document Range as Text will be interpreted as literal text. So you'd have to run some kind of code over the result to create the hyperlinks.

    What you could do (something not mentioned in that article, as I recall) is create concatenate the data somewhat differently. If we're talking about Word 2003, 2007 and/or 2010, put it into WordProcessingML or WordOpenXML then use the InsertXML method of the Range object.

    Another possibility would be to write the table information as HTML or RTF to a (temporary) file then use InsertFile to bring that into Word. InsertFile will automatically trigger Word's internal converters.


    Cindy Meister, VSTO/Word MVP
    Monday, August 1, 2011 2:08 PM
    Moderator

All replies

  • Hi Eyal

    I've split your question off into a new thread to make it more visible. It's always chancey, hoping to get a discussion from a much older thread that was answered some time ago. Especially when the question is a spin-off from the discussion, rather than involved with the original topic :-)

    There's nothing you can put into a string that will have Word automatically apply some kind of formatting or other conversion change. This applies to RTF, HTML or even Word's own XML vocabulary. What's written to a document Range as Text will be interpreted as literal text. So you'd have to run some kind of code over the result to create the hyperlinks.

    What you could do (something not mentioned in that article, as I recall) is create concatenate the data somewhat differently. If we're talking about Word 2003, 2007 and/or 2010, put it into WordProcessingML or WordOpenXML then use the InsertXML method of the Range object.

    Another possibility would be to write the table information as HTML or RTF to a (temporary) file then use InsertFile to bring that into Word. InsertFile will automatically trigger Word's internal converters.


    Cindy Meister, VSTO/Word MVP
    Monday, August 1, 2011 2:08 PM
    Moderator
  • Hi Cindy,

    Thanks for your answer,

    I will try at least one of the presented solutions and post back the results.

     

    Eyal.

    Tuesday, August 2, 2011 8:39 AM
  • I will try at least one of the presented solutions and post back the results.


    Hi Eyal

    How's it going? Have a resolution to your issue?


    Cindy Meister, VSTO/Word MVP
    Monday, August 8, 2011 9:44 AM
    Moderator