匯出PDF & EXCEL

匯出PDF & EXCEL

PDF

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication14.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <style>
        #the-canvas {
            border: 1px solid black;
            direction: ltr;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <a href="教學範例.pdf" class="btn btn-outline-danger">教學範例</a>(轉頁)
            </br></br>
            <a href="#" class="btn btn-outline-danger" onclick="window.open('教學範例.pdf', '_blank', config='height=800,width=1200');">教學範例</a>(跳出另一頁)
            </br></br>
            <a href="#" class="btn btn-outline-danger" onclick="window.open('教學範例.pdf', config='height=800,width=1200');">教學範例</a>(新增分頁)
            </br></br>
            <a href="123.xlsx">123.xlsx</a>
            </br></br>
            <a target="_blank" class="btn btn-outline-success" href="Excel.aspx">Link</a>
            </br></br>
        </div>
    </form>
</body>
</html>


EXCEL

https://www.codeproject.com/Questions/1222132/Download-excel-file-using-Csharp

https://blog.yowko.com/list-to-excel/