excel问题 总是高分 我想问个问题;就是我的报表是在服务器端生成的excel 然后我用浏览器打开了这个excel;但是现在我想直接调用客户端的excel应用程序打开我服务器上的生成的excel 那位知道告诉我 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果是在局域网内,可以用远程打开的方式,打开的文件地址写成 http://虚拟目录/文件相对地址。 http://虚拟目录/文件相对地址 这个可以! 生成excel文件后,用Response.WriteFile把文件输出到客户端,客户保存然后就可以直接打开了! 大哥们我不想用ie打开 我想用客户端excel应用程序打开我服务器上的.xls文件 <input type="hidden" name="out_word" onclick="vbscript:buildDoc" value="导出到word" class="notPrint"> <input type="hidden" name="out_excel" onclick="AutomateExcel();" value="导出到excel" class="notPrint"> <title>浏览器表格导出到Excel代码</title><input type="button" name="out_word" onclick="vbscript:buildDoc" value="导出到word" class="notPrint"> <input type="button" name="out_word1" onclick="javascript:AutomateExcel() " value="导出到excel" class="notPrint"> <table id="data" width="200" border="1"> <tr> <td>11</td> <td>11</td> </tr> <tr> <td>22</td> <td>22</td> </tr> <tr> <td>33</td> <td>33</td> </tr> <tr> <td>44 </td> <td>44</td> </tr></table><SCRIPT LANGUAGE="JavaScript"><!--function AutomateExcel() {// Start Excel and get Application object.var oXL = new ActiveXObject("Excel.Application"); // Get a new workbook.var oWB = oXL.Workbooks.Add();var oSheet = oWB.ActiveSheet;var table = document.all.data; var hang = table.rows.length;var lie = table.rows(0).cells.length; // Add table headers going cell by cell.for (i=0;i<hang;i++){for (j=0;j<lie;j++){oSheet.Cells(i+1,j+1).Value = table.rows(i).cells(j).innerText;}}oXL.Visible = true;oXL.UserControl = true;}//--></SCRIPT> 如果客户端安装了excel,那么总是在IE中打开的,除非你下载到本地,然后再打开:) 就像大家在做excel的时候 在文件->打开->然后输入一个url 一样 public void openfile(string filename) { Object Nothing=System.Reflection.Missing.Value; wb=app.Workbooks.Open("d://50269_EmployeeResume.xls",Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing); Excel.Worksheet xSheet=(Excel.Worksheet)wb.Worksheets[1]; this.app.Visible=true;// this._FileName=FileName; } 你的文件现在的地址是d://50269_EmployeeResume.xls把它放到你的Web文件夹里,然后把上面的地址改成http://虚拟目录/文件相对地址+文件名。 在web上,就是ie调用客户端excel应用程序,打开服务器上的.xls文件 那还不是用ie调用excel吗 我是想直接用excel打开 生成excel文件后,用Response.WriteFile把文件输出到客户端,客户保存然后就可以直接打开了!这个办法还是不错的 确认消息提示? 关于动态生成的table的问题 搞不懂的ASP.NET???? 如何从数据库中读出文章? 现在没技术的我遇到了这样的工程....是先学先做还是不做呢?大家请进! 关于利用客户端代码隐藏控件的问题 刚才还好好的,我招谁若谁了?不爽!散分! webpart parttitle 能否visible=false; 关于创建ASP.NET服务器控件的问题,请高手赐教。 checkbox的菜鸟问题,高分求解??? 树型控件的郁闷问题,求救 求浏览图片位置的按纽代码!!
<input type="hidden" name="out_excel" onclick="AutomateExcel();" value="导出到excel" class="notPrint"> <title>浏览器表格导出到Excel代码</title>
<input type="button" name="out_word" onclick="vbscript:buildDoc" value="导出到word" class="notPrint">
<input type="button" name="out_word1" onclick="javascript:AutomateExcel() " value="导出到excel" class="notPrint">
<table id="data" width="200" border="1">
<tr>
<td>11</td>
<td>11</td>
</tr>
<tr>
<td>22</td>
<td>22</td>
</tr>
<tr>
<td>33</td>
<td>33</td>
</tr>
<tr>
<td>44 </td>
<td>44</td>
</tr>
</table>
<SCRIPT LANGUAGE="JavaScript">
<!--
function AutomateExcel()
{
// Start Excel and get Application object.
var oXL = new ActiveXObject("Excel.Application");
// Get a new workbook.
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var table = document.all.data;
var hang = table.rows.length;var lie = table.rows(0).cells.length; // Add table headers going cell by cell.
for (i=0;i<hang;i++)
{
for (j=0;j<lie;j++)
{
oSheet.Cells(i+1,j+1).Value = table.rows(i).cells(j).innerText;
}}
oXL.Visible = true;
oXL.UserControl = true;
}
//-->
</SCRIPT>
{
Object Nothing=System.Reflection.Missing.Value;
wb=app.Workbooks.Open("d://50269_EmployeeResume.xls",Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing);
Excel.Worksheet xSheet=(Excel.Worksheet)wb.Worksheets[1];
this.app.Visible=true;
// this._FileName=FileName;
}
把它放到你的Web文件夹里,然后把上面的地址改成http://虚拟目录/文件相对地址+文件名。 在web上,就是ie调用客户端excel应用程序,打开服务器上的.xls文件
这个办法还是不错的