Solved

Open an excel document from HTML

Posted on 2004-08-11
9
236 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now