2024年8月25日 星期日

excel download

@{

    ViewBag.Title = "Home Page";

}


<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title></title>

</head>

<body id="linkContainer">

    <input type="file" id="fileUpload" />

    <button type="button" onclick="upload()">上傳</button>

    @Html.ActionLink("Download Excel", "Download", "Home", new { }, new { @class = "btn btn-primary" })


    <script>

        // 用於在 JavaScript 中設置 URL

        const uploadUrl = '@Url.Action("UploadFile", "Home")';


        function upload() {

            let fileUpload = document.getElementById("fileUpload");

            let file = fileUpload.files[0];


            if (!file) {

                alert("請選擇檔案");

                return; // 如果沒有選擇檔案,終止上傳

            }


            let formData = new FormData();

            formData.append("file", file);


            $.ajax({

                type: 'POST',

                url: uploadUrl,

                data: formData,

                processData: false,

                contentType: false,

                success: function (response) {

                    if (response.success) {

                        // 创建一个下载链接

                        var downloadLink = $('<a></a>')

                            .attr('href', response.fileUrl)

                            .attr('download', file.name) // 设置为下载并指定文件名

                            .text('Download File');


                        // 添加链接到页面

                        $('#linkContainer').html(downloadLink);


                        // 模拟点击下载链接

                        downloadLink[0].click();

                    } else {

                        alert("文件上傳失敗!");

                    }

                },

                error: function (xhr, status, error) {

                    alert(status + ' ' + error);

                }

            });

        }

    </script>

</body>

</html>


<a href="/Home/DownloadExcel" class="btn btn-primary">Download Excel</a>


2023年11月8日 星期三

-ㄹ/을까요? 提議/你覺得...?

 

連接規則

  • 有收音非ㄹ+을까요

    먹다→ 먹을까요

  • 沒收音+ㄹ까요

    사다→ 살까요?

  • ㄹ收音+까요

    열다→ 열까요

用法

  • 主詞為我們,「提議(我們)一起做…」

    같이 아침을 먹을까요? 我們一起去吃早餐嗎?

    같이 어머님께서 생일 선물 사러 갈까요? 我們一起去給媽媽買生日禮物嗎?

  • 主詞是第三人稱或我,「你覺得…? 」,**帶著好奇心詢問別人的觀點。

    • 第三人稱

      마리 씨 뚱뚱할까요? 你覺得瑪莉胖嗎?

      마리 씨 지금 어디에 있을까요? 你覺得現在瑪莉人在哪呢?

      마리 씨 저를 사랑했을까요? 你覺得瑪莉愛過我嗎?

    • 저 이거 살까요? 你覺得我應該買嗎?

      저 한국에 공부러 갈까요? 你覺得我應該去韓國讀書嗎?

excel download

@{     ViewBag.Title = "Home Page"; } <html xmlns="http://www.w3.org/1999/xhtml"> <head>     <title>...