2014-10-10 10 views
0

전 직장 동료로부터 C# Entity Framework 프로젝트를 인수했습니다. Javascript를 사용하는 데 익숙하지 않은 방식으로 테이블을 몇 개 설정했습니다. 이 데이터 테이블의 내용을 Excel 및 PDF 파일 (각각 별도의 단추)로 내 보내야합니다. C#, Javascript 또는 JQuery를 사용하고 있습니다.Excel 및 PDF로 C#/Javascript 데이터 테이블 내보내기

그래서, 내 마음을 최근 ColdFusion에서을하고있다, 심지어 거의 일년에 관련된 어떤 .NET 보았다하지 않은, 그래서 내가 한 번도 본 적이없는 그림 밖으로 물건뿐만 아니라 원기를 얻기 위해 노력하고 있어요 볶은 것.

PDF 버튼 :

I 헤더

<table id = "dataTable"> 
<thead> 
    <tr> 
     <th>Instructor ID</th> 
     <th>First Name</th> 
     <th>Last Name</th> 
     <th>Admin</th> 
     <th>Work Phone</th> 
     <th>Alt Phone</th> 
     <th>Cell Phone</th> 
     <th>Email Address</th> 
     <th>Rider Coach</th> 
     <th>Range Aid</th> 
     <th>Organ</th> 
     <th>Senior Inst</th> 
     <th>Date Added</th> 
     <th>Date Modified</th> 
     <th>Mod By</th> 
     <th>Active</th> 
     <th></th> 
    </tr> 
</thead> 

<tbody></tbody> 
</table> 

엑셀 버튼에 대한

   $(document).ready(function() { 

        var active = true; 

        GetList(active); 
       }); 

       function ChangeList() 
       { 
        GetList($("#ddlRiderType").val()); 
       } 

       function GetList(isActive) { 

        $('#dataTable').dataTable({ 
         "sDom": '<"top"lf>rt<"bottom"ip><"clear">', 
         "bAutoWidth": false, 
         "bProcessing": true, 
         "bSort": true, 
         "bDestroy": true, 
         "sPaginationType": "full_numbers", 
         "bServerSide": true, 
         "sAjaxSource": "Instructor.aspx/GetAllInstructors", 
         "fnServerData": function (sSource, aoData, fnCallback) { 

          var jsonData = "{jsonAOData : '" + JSON.stringify(aoData) + "', isActive: '" + isActive + "'}"; 

          $.ajax({ 
           //dataType: 'json', 
           contentType: "application/json; charset=utf-8", 
           type: "POST", 
           url: sSource, 
           data: jsonData, 
           complete: function() { Init(); }, 
           success: function (msg) { 
            if (msg.d != null) 
             fnCallback(msg.d); 
           }, 
           error: function (XMLHttpRequest, textStatus, errorThrown) { 
            ntfy_push("Error", ServerFail()); 
           } 
          }); 
         }, 
         "aoColumnDefs": [ 

       { "sName": "Cipher", 
        "aTargets": [0], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "sName": "firstName", 
        "aTargets": [1] 
       }, 
       { "sName": "lastName", 
        "aTargets": [2] 
       }, 
       { "sName": "org", 
        "aTargets": [10] 
       }, 
       { "sName": "workPhone", 
        "aTargets": [4] 
       }, 
       { "sName": "altPhone", 
        "aTargets": [5], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "sName": "cellPhone", 
        "aTargets": [6], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "sName": "email", 
        "aTargets": [7] 
       }, 
       { "sName": "riderCoach", 
        "aTargets": [8], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "sName": "rangeAid", 
        "aTargets": [9], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "sName": "admin", 
        "aTargets": [3] 
       }, 
       { "sName": "seniorInst", 
        "aTargets": [11], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "sName": "dateAdded", 
        "aTargets": [12], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "sName": "dateMod", 
        "aTargets": [13], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "sName": "modBy", 
        "aTargets": [14], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "sName": "active", 
        "aTargets": [15], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "sName": "delete", 
        "aTargets": [16], 
        "bVisible": false, 
        "bSearchable": false 
       }, 
       { "fnRender": function() { 
        return "Edit"; 
       }, 
        "aTargets": [17] 
       }, 
       { "fnRender": function() { 
        return "Delete"; 
       }, 
        "aTargets": [18] 
       } 
      ], 
         "sDom": '<"toolbar">flrtip' 
        }); 

        $("div.toolbar").html("<div class = 'tableOption'><img src = 'image/button/new-icon.png'/ alt= 'Add New Class' style = 'cursor:pointer' onclick = 'Show_New_Instructor()'></div>"); 
       } 

DataTable을 사용 :

자바 스크립트 코드는 데이터 테이블을 채우는 데 사용 요 감사합니다 사전에 도움을 요청하십시오.이 게시물이 이미 어딘가에 있다면 나는 그것을 간과해서 사과드립니다.

답변

0

당신은 세 가지 플랫폼 중 하나를 사용하여 열려 있기 때문에, 당신은 당신이 당신의 C# 코드에서 MS 오피스의 사용을 극대화 할 수있는 것을 특징으로 오피스 상호 운용성을 확인 할 수 있습니다

http://msdn.microsoft.com/en-ca/library/dd264733.aspx