a link to open the file in its native file format

i need to have the instance of the words in the opened file to be high lighted

In some, and likely all, cases you are going to have to modify the file. This means that either you are going to be creating a temporary file and presenting that to the user (making highlighted search results effectively Read Only), or you are going to be making changes to the original document.

Either way, how you go about making the changes to the files depends on the data format (i.e. you are going to need a different solution for PDF then for OpenDocument).

Given that you are searching them already, I think it is safe to assume that you can read the files without much difficulty. This means you might want to consider the Google approach - which is to create a copy of the document in a single standard format (Google use a combination of invalid HTML and invalid CSS) and make your changes to that copy.


In reply to Re^3: how to open and highlight text by dorward
in thread how to open and highlight text by arunmep

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.