Solved

Open an excel document from HTML

Posted on 2004-08-11
9
235 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

707 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

13 Experts available now in Live!

Get 1:1 Help Now