tags:

views:

173

answers:

4

It would make my user's lives much easier if I could do the following;

  • Allow an Excel document to be viewed (not edited) in Internet Explorer 8

  • Facilitate jumping to particular sheets in that document

I can embed the Excel file using an iframe which works, but I am utterly stuck when it comes to jumping to a particular named worksheet in that document.

Is this possible? I'm thinking either some way to force the document to show a particular worksheet first, via the src attribute, or controlling the embeded doc via javascript.

A: 

I am not sure if you can do this with JavaScript. But another question. Do you generate this file on the server side? Then you could embed some macro which would jump to this partcular worksheet.

Raffael Luthiger
The file is indeed generated on the server side. Embedding a macro is an idea, but the macro would need to be able to 'see' the contents of the HTML is the page. Basically what I need to do is jump to different sheets according to which html element is clicked on.
GrahamB
@GrahamB, bearing the above comment in mind, can you not simply use links and jQuery (or other js library or plain js) to simply swap-in the appropriate 'sheet'?
David Thomas
+1  A: 

If you are serving XMLSS you can specify the ActiveSheet, ActiveRow, and ActiveCol. If you are using a third-party control, they usually have a way to set the active sheet and range. If you are serving a HTML table or cvs, you are out of luck.

  <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
   <ActiveSheet>1</ActiveSheet>
  </ExcelWorkbook>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <Selected/>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>16</ActiveRow>
     <ActiveCol>5</ActiveCol>
    </Pane>
   </Panes>
  </WorksheetOptions>
AMissico
+1  A: 

Have you tried the PHP excel reader? I used it for similar purposes once. http://sourceforge.net/projects/phpexcelreader/

anijhaw
A: 

Thought of something. Use AJAX, post back when HTML element changes, re-serve the workbook with a modified open workbook macro that uses the post back data to display the proper worksheet and range. Since there is no browser refresh flash, the user may/will never notice. The only downside, is the round-trip back to the server.

AMissico