deep linking in Excel sheets exported to html

Posted by pomarc on Stack Overflow See other posts from Stack Overflow or by pomarc
Published on 2010-06-01T09:19:44Z Indexed on 2010/06/01 9:23 UTC
Read the original article Hit count: 234

Filed under:
|
|
|

hello everybody,

I am working on a project where I must export to html a lot of Excel files. This is pretty straightforward using automation and saving as html.

The problem is that many of these sheets have links to worksheets of some other files. I must find a way to write a link to a single inner worksheet.

When you export a multisheet excel file to html, excel creates a main htm file, a folder named filename_file, and inside this folder it writes down several files: a css, an xml list of files, a file that creates the tab bar and several html files named sheetxxx.htm, each one representing a worksheet.

When you open the main file, you can click the menu bar at the bottom which lets you select the appropriate sheet. This is in fact a link, which replaces a frame content with the sheetxxx.htm file. When this file is loaded a javascript function that selects the right tab gets called.

The exported files will be published on a web site. I will have to post process each file and replace every link to the other xls files to the matching htm file, finding a way to open the right worksheet.

I think that I could add a parameter to the processed htm file link url, such as myfile.htm?sh=sheet002.htm if I want to link to the second worksheet of myfile.htm (ex myfile.xls). After I've exported them, I could inject a simple javascript into each of the main files which, when they are loaded, could retrieve the sh parameter with jQuery (this is easy) and use this to somehow replace the frSheet frame contents (where the sheets get loaded), opening the right inner sheet and not the default sheet (this is what I call deep linking) mimicking what happens when a user clicks on a tab.

This last step is missing... :) I am considering different options, such as replacing the source of the $("frSheet") frame after document.ready.

I'd like to hear from you any advice on what could be the best way to realize that in your opinion.

any help is greately appreciated, many thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html