zoukankan      html  css  js  c++  java
  • 将后台数据读取到前台的EXCEL文件中去,用javascript实现,asp.net,javacript(发一个原创)

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        
    <title>无标题页</title>
    </head>
    <body>
        
    <form id="form1" runat="server">

    <%
        Response.Write(
    "请加入信任站点");
     
    %>
            
    <script language="javascript" type="text/javascript">
                 
    var xlApp,xlBook,xlSheet;
                 xlApp 
    = new ActiveXObject("Excel.Application");
                 xlBook 
    = xlApp.Workbooks.Add();
                 xlBook.Worksheets.Add();
                 xlBook.Worksheets.Add();
                 
    var quArray = new Array(" ","1","2","3","4","5");    
                 
    var i;
                 
    for( i=1;i<quArray.length;i++)
                {
                      xlSheet 
    = xlBook.Worksheets(i);
                      xlSheet.Name 
    = quArray[i];
                 }
                   
             
    <%
                  
    for(int j=1;j<=5;j++)
                  {               
             
    %>
                   xlSheet 
    = xlBook.Worksheets(quArray[<%=j%>]);
                   i
    =1;
                   xlSheet.Cells(i
    ++,1).Value = "小名";
                   xlSheet.Cells(
    1,2).Value = "d";
                   xlSheet.Cells(
    1,3).Value = "a";
                   xlSheet.Cells(
    1,4).Value = "c";
                   
                   
    var con = i-1;        
                   xlSheet.Rows(
    "1:"+con).Font.Size = 9;
                   xlSheet.Rows(
    "1:"+con).RowHeight = 15;
                   xlSheet.Range(
    "A1:D1").Interior.ColorIndex = 15;
                   xlSheet.Range(
    "A1:D1").Interior.Pattern = 1;
                   xlSheet.Range(
    "A1:D1").Font.ColorIndex = 1;
                   xlSheet.Range(
    "A1:D1").HorizontalAlignment = 3;   
                   xlSheet.Range(
    "A1:D"+con).Borders.Weight = 2;
                   xlSheet.Range(
    "A1:D"+con).Borders.ColorIndex = 1;
                   xlSheet.Columns(
    "A:D").EntireColumn.AutoFit;               

    <%
         }
    %>
                  
        xlApp.Visible 
    = true;
        idTmr 
    = window.setInterval("Cleanup();",1);
    function Cleanup() {
       window.clearInterval(idTmr);
       CollectGarbage();
     }
      window.opener
    =null;
    window.close();
                
            
    </script>

        
    </form>
    </body>
    </html>
  • 相关阅读:
    Nginx的启动、停止与重启
    如何修改element.style中的值
    在centos后台运行python程序(nohup)
    Python schedule 模块使用
    「Django」Django内置email发送邮件
    Django内置email发送邮件
    「Django」Xadmin应用
    「Django」浏览+1的操作
    「Vue」watch基本用法
    「Django」contenttypes基本用法
  • 原文地址:https://www.cnblogs.com/ma/p/751971.html
Copyright © 2011-2022 走看看