Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Open an excel document from HTML

Posted on 2004-08-11
9
238 Views
Last Modified: 2008-02-01
I am using a dialog box to write some data in TSV format (Tab Separated Value).  

I would like my diaglog box to open in MS Excel.

How do I do this?
Thank you!!!
John
0
Comment
Question by:JohnTirone
9 Comments
 
LVL 7

Expert Comment

by:mark-b
ID: 11775933
Example:

excel.html :

<html>
 <body>
  <a href="excel.xls" target="_blank" >go to excel</a>
 </body>
</html>

excel.xls :

1       2       3       4       5
6       7       8       9       10

This will open the TSV file in excel.

-Mark
0
 
LVL 3

Expert Comment

by:alskdj80
ID: 11793277
some browsers may have problems opening the .xls, it might be good to set the MIME ContentType to
<mime type="application/vnd.ms-excel"> just to be safe
0
 

Author Comment

by:JohnTirone
ID: 11811677
Ok, I had already gotten that far, but what I really want to have happen is instead of opening MS Excel within the browser itself, is to have MS Excel (the application) open, not within the browser window.

0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:JohnTirone
ID: 11812191
I guess another way to look at this question:  How do I remove the address line?
0
 

Author Comment

by:JohnTirone
ID: 11822684
Ok,

I figured out what my problem was.
1.      Open control panel
2.      Open folder options
3.      In the folder options window, scroll down & select XLS, then click advanced
4.      make sure the “Browse in same window” is NOT CHECKED.

THIS i combination with setting the mime type opens excel it the application vs. the browser window.

Now, is there another way to do this without me going into control panel?

0
 
LVL 31

Accepted Solution

by:
seanpowell earned 250 total points
ID: 11965285
Hi John,

Here's one option for you, although this is preferable for an intranet becasue of ActiveX

<html>
<head>
<script language="VBScript">
Dim objExcel

Sub Btn1_onclick()
      call OpenWorkbook("file:///E:/myfile.xls")
End Sub

Sub OpenWorkbook(strLocation)

Set objExcel = CreateObject("Excel.Application")
      objExcel.Visible = true
      objExcel.Workbooks.Open strLocation
      objExcel.UserControl = true
End Sub

</script>
</head>
<body>

<a href="#" name="Btn1">Open Workbook</a>

</body>
</html>



Note:
The url could either be:

OpenWorkbook("\\server\share\folder\myfile.xls")
OpenWorkbook("d:\folder\myfile.xls")

Thanks,
Sean
0
 
LVL 2

Assisted Solution

by:cheyennejk
cheyennejk earned 250 total points
ID: 11974199
USE XML tags to convert HTML tables into Excel tables and open as .xls in a new window.
 Here is an example:

<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
 <x:ExcelWorkbook>
  <x:ExcelWorksheets>
   <x:ExcelWorksheet>
    <x:Name>Sheet1</x:Name>
    <x:WorksheetOptions>
     <x:Selected/>
     <x:Panes>
      <x:Pane>
       <x:Number>3</x:Number>
       <x:ActiveRow>2</x:ActiveRow>
       <x:ActiveCol>2</x:ActiveCol>
      </x:Pane>
     </x:Panes>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
   <x:ExcelWorksheet>
    <x:Name>Sheet2</x:Name>
    <x:WorksheetOptions>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
   <x:ExcelWorksheet>
    <x:Name>Sheet3</x:Name>
    <x:WorksheetOptions>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
  </x:ExcelWorksheets>
  <x:WindowHeight>9090</x:WindowHeight>
  <x:WindowWidth>15180</x:WindowWidth>
  <x:WindowTopX>120</x:WindowTopX>
  <x:WindowTopY>15</x:WindowTopY>
  <x:ProtectStructure>False</x:ProtectStructure>
  <x:ProtectWindows>False</x:ProtectWindows>
 </x:ExcelWorkbook>




<body link=blue vlink=purple>

<table x:str border=0 cellpadding=0 cellspacing=0 width=192 style='border-collapse:
 collapse;table-layout:fixed;width:144pt'>
 <col width=64 span=3 >
 <tr height=17 style='height:12.75pt'>
  <td height=17 width=64 ></td>
  <td width=64 style='width:48pt'></td>
  <td width=64 style='width:48pt'></td>
 </tr>
 <tr height=17 style='height:12.75pt'>
  <td height=17 colspan=3 ></td>
 </tr>
 <tr height=17 style='height:12.75pt'>
  <td height=17 align=right  >HELLO</td>
  <td align=right >HI</td>
  <td align=right >GOOD BYE</td>
 </tr>
 </table>
</body>
</html>



0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question