2024年5月16日 星期四

[研究]ASP.NET,Aspose.Cells 24.5.0 授權檔安裝與試用

[研究]ASP.NET,Aspose.Cells 24.5.0 授權檔安裝與試用

2024-05-16

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

********************************************************************************

如果沒有設定 Aspose License File 授權檔 (商業付費購買),產出的檔案會顯示 "Evaluation Only. Created with Aspose.Cells for .NET.Copyright 2003 - 2024 Aspose Pty Ltd.

********************************************************************************


(下圖) 授權檔案可以看出期限

Default.aspx.cs

using Aspose.Cells;
using System;

namespace WebApplication1
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // 如果沒有設定 Aspose License File,產出的檔案會
            // 顯示 "Evaluation Only. Created with Aspose.Cells for .NET.Copyright 2003 - 2024 Aspose Pty Ltd.

            //Aspose.Cells.License license = new Aspose.Cells.License();
            //string licenseFilePath = Server.MapPath("~/App_Data/") + "Aspose.Total.Product.Family.lic";
            //license.SetLicense(licenseFilePath); // 替換為你的授權檔案路徑

            // 讀取 .ods 檔案
            Workbook workbook = new Workbook(@"C:\temp\input.ods"); // 替換為你的 .ods 檔案路徑

            // 將 .ods 檔案儲存為 .xlsx 檔案
            workbook.Save(@"C:\Temp\output.xlsx", SaveFormat.Xlsx); // 替換為你想要儲存的 .xlsx 檔案路徑
        }
    }
}



(完)

相關

(完)

2024年5月10日 星期五

[研究]ASP.NET, Font.Awesome 5.15.4套件試用、使用確認、非NuGet安裝移除

[研究]ASP.NET, Font.Awesome 5.15.4套件試用、使用確認、非NuGet安裝移除

2024-05-10

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

********************************************************************************

敝人某專案 packages.config 中並沒有 Font.Awesome,但 Mend軟體報告有使用,有可能外包商不是用 NuGet 安裝,測試看看到底有那些檔案。


沒有相依套件

檔案列表

  • \packages\Font.Awesome.5.15.4
  • \packages\Font.Awesome.5.15.4\.signature.p7s
  • \packages\Font.Awesome.5.15.4\Content
  • \packages\Font.Awesome.5.15.4\Font.Awesome.5.15.4.nupkg
  • \packages\Font.Awesome.5.15.4\Content\Content
  • \packages\Font.Awesome.5.15.4\Content\Scripts
  • \packages\Font.Awesome.5.15.4\Content\webfonts
  • \packages\Font.Awesome.5.15.4\Content\Content\all.css
  • \packages\Font.Awesome.5.15.4\Content\Content\all.min.css
  • \packages\Font.Awesome.5.15.4\Content\Content\brands.css
  • \packages\Font.Awesome.5.15.4\Content\Content\brands.min.css
  • \packages\Font.Awesome.5.15.4\Content\Content\fontawesome.css
  • \packages\Font.Awesome.5.15.4\Content\Content\fontawesome.min.css
  • \packages\Font.Awesome.5.15.4\Content\Content\regular.css
  • \packages\Font.Awesome.5.15.4\Content\Content\regular.min.css
  • \packages\Font.Awesome.5.15.4\Content\Content\solid.css
  • \packages\Font.Awesome.5.15.4\Content\Content\solid.min.css
  • \packages\Font.Awesome.5.15.4\Content\Content\svg-with-js.css
  • \packages\Font.Awesome.5.15.4\Content\Content\svg-with-js.min.css
  • \packages\Font.Awesome.5.15.4\Content\Content\v4-shims.css
  • \packages\Font.Awesome.5.15.4\Content\Content\v4-shims.min.css
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\all.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\all.min.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\brands.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\brands.min.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\conflict-detection.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\conflict-detection.min.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\fontawesome.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\fontawesome.min.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\regular.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\regular.min.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\solid.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\solid.min.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\v4-shims.js
  • \packages\Font.Awesome.5.15.4\Content\Scripts\fontawesome\v4-shims.min.js
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-brands-400.eot
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-brands-400.svg
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-brands-400.ttf
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-brands-400.woff
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-brands-400.woff2
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-regular-400.eot
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-regular-400.svg
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-regular-400.ttf
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-regular-400.woff
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-regular-400.woff2
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-solid-900.eot
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-solid-900.svg
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-solid-900.ttf
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-solid-900.woff
  • \packages\Font.Awesome.5.15.4\Content\webfonts\fa-solid-900.woff2


  • \WebApplication1\Content\all.css
  • \WebApplication1\Content\all.min.css
  • \WebApplication1\Content\brands.css
  • \WebApplication1\Content\brands.min.css
  • \WebApplication1\Content\fontawesome.css
  • \WebApplication1\Content\fontawesome.min.css
  • \WebApplication1\Content\regular.css
  • \WebApplication1\Content\regular.min.css
  • \WebApplication1\Content\solid.css
  • \WebApplication1\Content\solid.min.css
  • \WebApplication1\Content\svg-with-js.css
  • \WebApplication1\Content\svg-with-js.min.css
  • \WebApplication1\Content\v4-shims.css
  • \WebApplication1\Content\v4-shims.min.css


  • \WebApplication1\Scripts\fontawesome
  • \WebApplication1\Scripts\fontawesome\all.js
  • \WebApplication1\Scripts\fontawesome\all.min.js
  • \WebApplication1\Scripts\fontawesome\brands.js
  • \WebApplication1\Scripts\fontawesome\brands.min.js
  • \WebApplication1\Scripts\fontawesome\conflict-detection.js
  • \WebApplication1\Scripts\fontawesome\conflict-detection.min.js
  • \WebApplication1\Scripts\fontawesome\fontawesome.js
  • \WebApplication1\Scripts\fontawesome\fontawesome.min.js
  • \WebApplication1\Scripts\fontawesome\regular.js
  • \WebApplication1\Scripts\fontawesome\regular.min.js
  • \WebApplication1\Scripts\fontawesome\solid.js
  • \WebApplication1\Scripts\fontawesome\solid.min.js
  • \WebApplication1\Scripts\fontawesome\v4-shims.js
  • \WebApplication1\Scripts\fontawesome\v4-shims.min.js


  • \WebApplication1\webfonts\fa-brands-400.eot
  • \WebApplication1\webfonts\fa-brands-400.svg
  • \WebApplication1\webfonts\fa-brands-400.ttf
  • \WebApplication1\webfonts\fa-brands-400.woff
  • \WebApplication1\webfonts\fa-brands-400.woff2
  • \WebApplication1\webfonts\fa-regular-400.eot
  • \WebApplication1\webfonts\fa-regular-400.svg
  • \WebApplication1\webfonts\fa-regular-400.ttf
  • \WebApplication1\webfonts\fa-regular-400.woff
  • \WebApplication1\webfonts\fa-regular-400.woff2
  • \WebApplication1\webfonts\fa-solid-900.eot
  • \WebApplication1\webfonts\fa-solid-900.svg
  • \WebApplication1\webfonts\fa-solid-900.ttf
  • \WebApplication1\webfonts\fa-solid-900.woff
  • \WebApplication1\webfonts\fa-solid-900.woff2

********************************************************************************

Default.aspx

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

<!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>
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" />
</head>
<body>
    <form id="form1" runat="server">
        <asp:Button ID="btnSubmit" runat="server" Text="Submit" CssClass="btn btn-primary">
        </asp:Button>
        <asp:Literal ID="litStarIcon" runat="server" Text='<i class="fas fa-star"></i>'></asp:Literal>
    </form>
</body>
</html>




註解掉 Font.Awesome 引用後,特殊圖案字會不見。

********************************************************************************

要確定 ASP.NET WebForm 專案是否真的使用了 Font Awesome 資源,可考慮:

檢查 ASP.NET WebForm 頁面(.aspx 檔案)或使用者控制項(.ascx 檔案)中的 HTML 和 CSS 程式碼。 尋找是否有引用 Font Awesome 的 CSS 檔案(通常是 font-awesome.css font-awesome.min.css)或字體檔案(通常在 font 資料夾中)。


尋找是否有使用 Font Awesome 的 CSS 類別或圖標,例如 <i class="fas fa-user"></i>。

********************************************************************************

注意,檢查packages.config檔案中套件,是否有任何套件使用(相依) Font.Awesome套件。

********************************************************************************

要移除非NuGet安裝的Font.Awesome,

********************************************************************************

(完)


[研究]Mend, Font.Awesome 5.15.4 與 floating-table-of-contents-1.0.0 授權疑問

[研究]Mend, Font.Awesome 5.15.4 與 floating-table-of-contents-1.0.0 授權研究

2024-05-10

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

********************************************************************************

參考

[研究]ASP.NET, Font.Awesome 5.15.4安裝套件研究
https://shaurong.blogspot.com/2024/05/aspnet-fontawesome-5154.html

********************************************************************************

Font.Awesome 授權
https://fontawesome.com/license/free

MEND 說使用了 GPL 2.0 的 floating-table-of-contents-1.0.0,但 packages.config 沒看到,看訊息是 Font.Awesome 使用了 floating-table-of-contents-1.0.0

floating-table-of-contents-1.0.0

https://plugins.svn.wordpress.org/floating-table-of-contents
https://plugins.svn.wordpress.org/floating-table-of-contents/tags/1.0.0

其中下面網址說是GPL-2.0授權

https://plugins.svn.wordpress.org/floating-table-of-contents/tags/1.0.0/readme.txt

檢視 floating-table-of-contents-1.0.0 的 Source File List,看不出 Font.Awesome 有使用 floating-table-of-contents-1.0.0 ???
https://plugins.svn.wordpress.org/floating-table-of-contents/tags/1.0.0/src/

檢視Font.Awesome 5.15.4的 conflict-detection.js 內容,並非 GPL-2.0

/*!
 * Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
 */

待研究...

(待續)


2024年5月9日 星期四

[研究]Mend, Select2 與wicked-folders 2.18.4 和 pdf-poster-1.6.5 套件 GPT 或 MIT 授權疑問

[研究]Mend, Select2 與wicked-folders 2.18.4 和 pdf-poster-1.6.5 套件 GPT 或 MIT 授權疑問

2024-05-09

https://github.com/select2/select2/blob/develop/LICENSE.md

select2 是MIT授權

但 MEND 軟體說 select2使用的 wicked-folders 2.18.4 是 GPL-2.0
https://plugins.svn.wordpress.org/wicked-folders/tags/2.18.4/readme.txt

實際檢視 \Scripts\i18n\zh-TW.js 內容

用 Free Online Javascript Beautifier / Formatter 優化可讀性


/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */

! function () {
   if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) var n = jQuery.fn.select2.amd;
   n.define("select2/i18n/zh-TW", [], function () {
      return {
         inputTooLong: function (n) {
            return "請刪掉" + (n.input.length - n.maximum) + "個字元"
         },
         inputTooShort: function (n) {
            return "請再輸入" + (n.minimum - n.input.length) + "個字元"
         },
         loadingMore: function () {
            return "載入中…"
         },
         maximumSelected: function (n) {
            return "你只能選擇最多" + n.maximum + "項"
         },
         noResults: function () {
            return "沒有找到相符的項目"
         },
         searching: function () {
            return "搜尋中…"
         },
         removeAllItems: function () {
            return "刪除所有項目"
         }
      }
   }), n.define, n.require
}();

看不出哪裡使用  wicked-folders 2.18.4,不知是否誤判?

Mend 軟體說 \Scripts\i18n\zh-TW.js 是 wicked-folders-2.18.14 的,但是實際檢視

  • font-awesome/
  • select2/
  • sticky-kit/
不太清楚這是指  wicked-folders-2.18.14 販售給這3個套件?還是甚麼關係?

wicked-folders 有不同版本


********************************************************************************

MEND 報告 \Scripts\i18n\zh-TW.js 也使用 pdf-poster-1.6.5 套件,是 GPL-2.0,但看不出來。

(待續)

相關

[研究]ASP.NET, 比較 select2, Selectize.js, Chosen, Bootstrap Select 下拉選單套件

[研究]ASP.NET, 比較 select2, Selectize.js, Chosen, Bootstrap Select 下拉選單套件

2024-05-06

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

********************************************************************************

ASP.NET, 請比較 select2, Selectize.js, Chosen, Bootstrap Select 特點 ? 優點 ? 缺點 ? 市佔率 (百分比) ? 用表格呈現 ?

ChatGPT

特點select2Selectize.jsChosenBootstrap Select
功能搜索、選項過濾、多選、AJAX 加載、主題自定義搜索、選項過濾、多選、創建新標籤、輕量級搜索、選項過濾、多選、默認主題美觀搜索、多選、與 Bootstrap 樣式相容
優點功能豐富、支援 AJAX 加載、主題自定義輕量、功能全面、支援創建新標籤美觀的默認主題、易於使用、與 Bootstrap 相容與 Bootstrap 樣式相容、易於使用
缺點樣式定製複雜、文件較大功能相對 select2 有限、樣式定製有限文件較大、功能相對有限功能相對有限、樣式定製有限
市佔率約 60%約 15%約 10%約 15%

********************************************************************************

Copilot

選項特點優點缺點市佔率
select2- 支持搜索和遠程數據源。
- 具有良好的自定義選項,例如主題、佈局和樣式。
- 強大的搜索功能,適用於大型數據集。- 需要引入 jQuery。
- 部分功能可能需要進一步自定義。
約 20%
Selectize.js- 允許用戶即時創建新選項。
- 可以選擇並刪除多個項目。
- 異步友好,支持回調。- 需要引入 Selectize.js 腳本。
- 部分功能可能需要進一步自定義。
受歡迎
Chosen- 基於 jQuery,易於使用。- 簡單易用,適合快速開發。
- 可以自定義樣式和佈局。
- 不支持異步數據源。
- 需要引入 jQuery。
不清楚
Bootstrap Select- 基於 Bootstrap,與 Bootstrap 样式一致。
- 支持搜索和多選。
- 與 Bootstrap 集成良好。- 需要引入 Bootstrap 和相關腳本。
- 部分功能可能需要進一步自定義。
約 10%

********************************************************************************

********************************************************************************


Default.aspx

xxx


Default.aspx.cs

xxx


aaa

(完)

相關

[研究]ASP.NET,WebForm,試用 Bootstrap Select 1.13.18件,下拉選單關鍵字過濾顯示

[研究]ASP.NET,WebForm,試用 Bootstrap Select 1.13.18套件,下拉選單關鍵字過濾顯示

2024-05-06

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

********************************************************************************

https://github.com/selectize/selectize.js
授權 Apache-2.0


WebApplication1

正在安裝:

jQuery.1.9.1
bootstrap.3.0.0
bootstrap-select.1.13.18

********************************************************************************

Default.aspx

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

<!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>
    <%--<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.3.3/css/bootstrap.min.css">--%>
    <%--<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.6.2/css/bootstrap.min.css">--%>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/css/bootstrap-select.min.css">
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <%--<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/5.3.3/js/bootstrap.bundle.min.js"></script>--%>
    <%--<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.6.2/js/bootstrap.bundle.min.js"></script>--%>
    <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.bundle.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/js/bootstrap-select.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.selectpicker').selectpicker();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
            <asp:DropDownList ID="DropDownList1" runat="server" CssClass="selectpicker" AutoPostBack="true">
                <asp:ListItem>Option 1</asp:ListItem>
                <asp:ListItem>Option 2</asp:ListItem>
                <asp:ListItem>Option 3</asp:ListItem>
            </asp:DropDownList>
    </form>
</body>
</html>


Bootstrap 5.3.3 和4.6.2 版測試有問題

Bootstrap 3.4.1 版測試有問題

********************************************************************************

Default2.aspx

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

<!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>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.14.0-beta2/css/bootstrap-select.min.css">
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.14.0-beta2/js/bootstrap-select.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.selectpicker').selectpicker();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <select id="ddlOptions" class="selectpicker" data-live-search="true" runat="server">
                <option value="1">Option 1</option>
                <option value="2">Option 2</option>
                <option value="3">Option 3</option>
                <option value="4">Option 4</option>
                <option value="5">Option 5</option>
            </select>
        </div>
    </form>
</body>
</html>

測試正常

表示 jQuery、bootstrap、bootstrap-select.要某些版本組合才可正常運作。

而 bootstrap-select 1.13.18 說只要 jQuery >= 1.9.1 && < 4.0.0 和 bootstrap >= 3.0.0 ,實際測試不行。


(完)

相關

[研究]ASP.NET,WebForm,試用 Chosen 1.2.0 套件,下拉選單關鍵字過濾顯示

[研究]ASP.NET,WebForm,試用 Chosen 1.2.0 套件,下拉選單關鍵字過濾顯示

2024-05-06

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

********************************************************************************

https://github.com/prabirshrestha/chosen
https://github.com/prabirshrestha/chosen/tags
prabirshrestha 的 Chosen,目前最新1.2.0版,NuGet提供安裝

https://github.com/harvesthq/chosen
Harvesthq 的 Chosen,目前最新1.8.7版,NuGet不提供安裝

https://github.com/prabirshrestha/chosen/blob/master/LICENSE.md
授權 MIT






********************************************************************************



********************************************************************************

Default.aspx

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

<!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 type="text/javascript"src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <%--<link href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.min.css" rel="stylesheet" />
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.jquery.min.js"></script>--%>
    <link href="Content/chosen.css" rel="stylesheet" />
    <script type="text/javascript" src="Scripts/chosen.jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.chosen-select').chosen();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:DropDownList ID="ddlOptions" CssClass="chosen-select" runat="server">
                <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
                <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
                <asp:ListItem Text="Option 3" Value="3"></asp:ListItem>
                <asp:ListItem Text="Option 4" Value="4"></asp:ListItem>
                <asp:ListItem Text="Option 5" Value="5"></asp:ListItem>
            </asp:DropDownList>
        </div>
    </form>
</body>
</html>


********************************************************************************

兩者實際測試,都可以用。


(完)

相關

2024年5月8日 星期三

[研究]ASP.NET,WebForm,試用 Selectize.js 0.12.1 套件,下拉選單關鍵字過濾顯示

[研究]ASP.NET,WebForm,試用 Selectize.js 0.12.1 套件,下拉選單關鍵字過濾顯示

2024-05-06

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

********************************************************************************

https://github.com/selectize/selectize.js
授權 Apache-2.0



雖然沒有顯示相依 jQuery 套件,實際測試需要。

另外 selectize.min.js 必須使用 standalone 版本才行。

********************************************************************************

Default.aspx

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

<!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>
    <link href="Content/Selectize/css/selectize.css" rel="stylesheet" />
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script type="text/javascript" src="Content/Selectize/js/standalone/selectize.min.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:DropDownList ID="DropDownList1" runat="server" Width="100px">
            <asp:ListItem Text="--請選擇--" Value=""></asp:ListItem>
            <asp:ListItem Text="選項1" Value="1"></asp:ListItem>
            <asp:ListItem Text="選項2" Value="2"></asp:ListItem>
            <asp:ListItem Text="選項3" Value="3"></asp:ListItem>
            <asp:ListItem Text="選項4" Value="4"></asp:ListItem>
        </asp:DropDownList>
        <br />
        <asp:DropDownList ID="DropDownList2" runat="server" Width="100px">
            <asp:ListItem Text="--請選擇--" Value=""></asp:ListItem>
            <asp:ListItem Text="選項1" Value="1"></asp:ListItem>
            <asp:ListItem Text="選項2" Value="2"></asp:ListItem>
            <asp:ListItem Text="選項3" Value="3"></asp:ListItem>
            <asp:ListItem Text="選項4" Value="4"></asp:ListItem>
        </asp:DropDownList>
    </form>
 <script type="text/javascript">
     $(document).ready(function () {
         // 使用 Selectize.js 初始化 DropDownList
         $('#<%= DropDownList1.ClientID %>').selectize({
                create: false, // 禁止創建新選項
                sortField: 'text', // 按文本排序
                searchField: ['text'], // 搜索字段為文本
                dropdownParent: 'body' // 下拉框父元素
            });
        });
 </script>
 <script type="text/javascript">
     $(document).ready(function () {
         $('#<%= DropDownList2.ClientID %>').selectize();
     });
 </script>
</body>
</html>



********************************************************************************

改用 CssClass 方式執行會失敗

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

<!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>
    <link href="Content/Selectize/css/selectize.css" rel="stylesheet" />
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script type="text/javascript" src="Content/Selectize/js/standalone/selectize.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.selectize-input').selectize();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:DropDownList ID="DropDownList1" runat="server" CssClass="selectize-input" Width="150px">
            <asp:ListItem Text="--請選擇--" Value=""></asp:ListItem>
            <asp:ListItem Text="選項1" Value="1"></asp:ListItem>
            <asp:ListItem Text="選項2" Value="2"></asp:ListItem>
            <asp:ListItem Text="選項3" Value="3"></asp:ListItem>
            <asp:ListItem Text="選項4" Value="4"></asp:ListItem>
        </asp:DropDownList>
    </form>

</body>
</html>



********************************************************************************

改用 CssClass 方式執行成功,可能 CssClass 的名稱不能有減號

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

<!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>
    <link href="Content/Selectize/css/selectize.css" rel="stylesheet" />
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script type="text/javascript" src="Content/Selectize/js/standalone/selectize.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.selectizeCss').selectize();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:DropDownList ID="DropDownList1" runat="server" CssClass="selectizeCss" Width="150px">
            <asp:ListItem Text="--請選擇--" Value=""></asp:ListItem>
            <asp:ListItem Text="選項1" Value="1"></asp:ListItem>
            <asp:ListItem Text="選項2" Value="2"></asp:ListItem>
            <asp:ListItem Text="選項3" Value="3"></asp:ListItem>
            <asp:ListItem Text="選項4" Value="4"></asp:ListItem>
        </asp:DropDownList>
    </form>

</body>
</html>



********************************************************************************


(完)

相關

[研究]uTorrent 3.6.0 build 47082已經安裝,你要降級到 3.6.0 build 47062 嗎?

[研究]uTorrent 3.6.0 build 47082已經安裝,你要降級到 3.6.0 build 47062 嗎?

2024-05-06

uTorrent.exe 啟動時出現下面訊息,是安裝到 beta版還是怎麼了嗎?我是從官方下載安裝的

A newer version of uTorrent, 3.6.0 build 47082 is already installed. Would you like to downgrade to 3.6.0 build 47062?

Downgrade Continue with newer version


https://www.utorrent.com/intl/zh_tw/downloads/win/
Basic 版目前是Stable 3.5.5 Build 45952

網頁上好像也沒可以任意下載特定版本。

https://www.utorrent.com/intl/zh_tw/desktop/
utorrent_installer.exe  是 3.6.0,沒有 build 版號


重新安裝一次,啟動時依舊該訊息,且依然是 build 47082




暫時不管了。

(完)

相關

2024年5月2日 星期四

[研究]Windows Server 2022 中,能管理硬件的最低帳戶群組是什麼 ?

[研究]Windows Server 2022 中,能管理硬件的最低帳戶群組是什麼 ?

2024-05-02

Windows Server 2022 中,能管理硬件的最低帳戶群組是什麼 ?

ChatGPT

在 Windows Server 2022 中,能夠管理硬體的最低帳戶群組是 Administrators 管理員群組。 這個群組擁有系統中最高的權限,幾乎可以執行所有操作,包括管理硬體和設定係統。

*****

Windows Server 2022 中,能管理硬體的最低帳戶群組是甚麼 ? 參考資料網址 ?

Copilot

在 Windows Server 2022 中,能夠管理硬體的最低帳戶群組是 本機 Administrators。這個群組具有系統管理員權限,可以執行各種系統管理工作,包括硬體設定、安全性設定等。如果您需要更詳細的資訊,您可以參考以下網址:保護本機 Administrators 帳戶和群組。

https://learn.microsoft.com/zh-tw/windows-server/identity/ad-ds/plan/security-best-practices/appendix-h--securing-local-administrator-accounts-and-groups

(完)



2024年5月1日 星期三

[研究]ASP.NET,試用FreeSpire.PDF 10.2.0 取代 .pdf 中的文字

[研究]ASP.NET,試用FreeSpire.PDF 10.2.0 取代 .pdf 中的文字

2024-04-30

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

********************************************************************************

NuGet Gallery | FreeSpire.PDF
https://www.nuget.org/packages/FreeSpire.PDF

Free .NET PDF API - Developing PDF in C#, VB.NET, ASP.NET
https://www.e-iceblue.com/Introduce/free-pdf-component.html

授權 License

Free Spire.PDF for .NET is a Community Edition of the Spire.PDF for .NET, which is a totally free PDF API for commercial and personal use. As a standalone .NET library, Free Spire.PDF for .NET enables developers to create, write, edit, convert, print, handle and read PDF files on any .NET( C#, VB.NET, ASP.NET, .NET Core) applications.

Free version is limited to 10 pages of PDF. This limitation is enforced during writing PDF. When converting PDF to Image, XPS, Word, HTML, you can only get the first 3 pages of file. We don't provide technical or any other support to the users of the free versions.

********************************************************************************

續這篇,本篇談 FreeSpire.PDF 8.6.0 升級到 FreeSpire.PDF 10.2.0

10.2.0約2024年3月或4月釋出 ( NuGet 上寫 a month ago),非常新,語法似乎又改了。

[研究][C#][ASP.NET] 使用 Free Spire.PDF for NET v6.2.0 取代 .pdf 中的文字
https://shaurong.blogspot.com/2020/06/caspnet-free-spirepdf-for-net-v620-pdf.html

FreeSpire.PDF 8.6.0 升級 FreeSpire.PDF 10.2.0 後,Visual Studio 2019 編譯出現警告
  • warning CS0618: 'PdfTextFindCollection' 已經過時: 'This class may be removed in the future.'
  • warning CS0618: 'PdfPageBase.FindText(string, TextFindParameter)' 已經過時: 'This method may be removed in the future, please use PdfTextFinder.Find(string text) instead.'
  • warning CS0618: 'PdfTextFind' 已經過時: 'This class may be removed in the future.'
  • warning CS0618: 'PdfTextFind.Bounds' 已經過時: 'This property may be removed in the future, please use TextBounds instead.'
參考

********************************************************************************



參考

Default.aspx

<asp:Button ID="btnGeneratePDF" runat="server" Text="Generate PDF" OnClick="Button1_Click" />

Default.aspx.cs

using Spire.Pdf;
using Spire.Pdf.Texts;

protected void Button1_Click(object sender, EventArgs e)
{
 // Create a PdfDocument object
            PdfDocument doc = new PdfDocument();

            // Load a PDF file
            doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Input.pdf");

            // Create a PdfTextReplaceOptions object
            PdfTextReplaceOptions textReplaceOptions = new PdfTextReplaceOptions();

            // Specify the options for text replacement
            textReplaceOptions.ReplaceType = PdfTextReplaceOptions.ReplaceActionType.IgnoreCase;
            textReplaceOptions.ReplaceType = PdfTextReplaceOptions.ReplaceActionType.WholeWord;
            textReplaceOptions.ReplaceType = PdfTextReplaceOptions.ReplaceActionType.AutofitWidth;

            // Get a specific page
            PdfPageBase page = doc.Pages[0];

            // Create a PdfTextReplacer object based on the page
            PdfTextReplacer textReplacer = new PdfTextReplacer(page);

            // Set the replace options
            textReplacer.Options = textReplaceOptions;

            // Replace all occurrences of target text with new text
            textReplacer.ReplaceAllText(".NET Framework", "New Content");
            textReplacer.ReplaceAllText("燒餅", "油條"); // 出錯了

            // Save the document to a different PDF file
            doc.SaveToFile("ReplaceTextInPage.pdf");

            // Dispose resources
            doc.Dispose();
}


直接拿官方範例來用,
textReplacer.ReplaceAllText(".NET Framework", "New Content");
改成用中文字,結果出錯了。
textReplacer.ReplaceAllText("燒餅", "油條"); // 出錯了

或者原來的 textReplacer.ReplaceAllText(".NET Framework", "New Content"); 保留,下面新增一行 textReplacer.ReplaceAllText("燒餅", "油條"); 結果原來的可以正常執行,但新增那行出錯。

System.NullReferenceException:'並未將物體參考

********************************************************************************

ASP.NET,WebForm, 下面是 FreeSpire.PDF 10.2.0 官方範例,

https://www.e-iceblue.com/Knowledgebase/Spire.PDF/Program-Guide/Text/Find-and-replace-text-on-PDF-document-in-C.html

把這行

textReplacer.ReplaceAllText(".NET Framework", "New Content");

改成用中文字,結果出錯了。

textReplacer.ReplaceAllText("燒餅", "油條"); // 出錯了


若原來的 textReplacer.ReplaceAllText(".NET Framework", "New Content"); 保留,

下面新增一行 textReplacer.ReplaceAllText("燒餅", "油條"); 

結果原來的那一行可以正常執行,但新增那一行出錯。


錯誤都是

System.NullReferenceException:'並未將物體參考


FreeSpire.PDF 10.2.0 的 ReplaceAllText 不支援中文字取代嗎 ? 還是要如何修改下面程式


using Spire.Pdf;

using Spire.Pdf.Texts;


protected void Button1_Click(object sender, EventArgs e)

{

 // Create a PdfDocument object

            PdfDocument doc = new PdfDocument();


            // Load a PDF file

            doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Input.pdf");


            // Create a PdfTextReplaceOptions object

            PdfTextReplaceOptions textReplaceOptions = new PdfTextReplaceOptions();


            // Specify the options for text replacement

            textReplaceOptions.ReplaceType = PdfTextReplaceOptions.ReplaceActionType.IgnoreCase;

            textReplaceOptions.ReplaceType = PdfTextReplaceOptions.ReplaceActionType.WholeWord;

            textReplaceOptions.ReplaceType = PdfTextReplaceOptions.ReplaceActionType.AutofitWidth;


            // Get a specific page

            PdfPageBase page = doc.Pages[0];


            // Create a PdfTextReplacer object based on the page

            PdfTextReplacer textReplacer = new PdfTextReplacer(page);


            // Set the replace options

            textReplacer.Options = textReplaceOptions;


            // Replace all occurrences of target text with new text

            textReplacer.ReplaceAllText(".NET Framework", "New Content");

            textReplacer.ReplaceAllText("燒餅", "油條"); // 出錯了


            // Save the document to a different PDF file

            doc.SaveToFile("ReplaceTextInPage.pdf");


            // Dispose resources

            doc.Dispose();

}

ChatGPT

這個問題可能是由於 FreeSpire.PDF 10.2.0 的 ReplaceAllText 方法無法正確處理中文文字所導致的。有幾個可能的解決方案:

  • 確認 ReplaceAllText 方法是否支援中文文字:查看官方文件或者其他資源,確定 ReplaceAllText 方法是否能夠處理中文文字。如果不支援,你可能需要採取其他方法來達到替換中文文字的目的。
  • 使用其他方法替換文字:如果 ReplaceAllText 方法無法處理中文文字,你可以考慮使用其他方法來替換文字,比如使用正則表達式進行替換。
  • 更新到最新版本:檢查是否有最新版本的 FreeSpire.PDF,有時更新版本可能修復了這樣的問題。
  • 聯繫支援:如果以上方法都無法解決問題,可以考慮聯繫 FreeSpire.PDF 的支援團隊,詢問他們關於中文文字替換的支援情況,或者是否有其他解決方案可供使用。

另外,我也注意到你在使用 ReplaceType 屬性時將其設置了多次,這樣只會保留最後一次的設置。你應該只設置一次 ReplaceType。

********************************************************************************

Copilot

FreeSpire.PDF for .NET 是一個功能強大且免費的 PDF API,可用於處理和操作 PDF 文件。不過,根據您的描述,您遇到了一個問題:在使用 textReplacer.ReplaceAllText("燒餅", "油條"); 時出現了 System.NullReferenceException 錯誤。

這個問題可能是由於 FreeSpire.PDF 10.2.0 的 ReplaceAllText 方法不支援中文字取代所導致的。您可以嘗試以下方法來解決這個問題:

確認文本存在:在替換文本之前,請確保您要替換的文本實際上存在於 PDF 文件中。您可以先使用 textReplacer.FindText("燒餅") 來查找文本,確認它是否存在。
使用 Unicode 編碼:中文字符需要使用 Unicode 編碼進行處理。您可以嘗試將 "燒餅" 和 "油條" 轉換為 Unicode 編碼,然後再進行替換。例如:

textReplacer.ReplaceAllText("\u70e7\u9915", "\u6cb9\u6a1e");

AI 產生的代碼。請仔細檢視及使用。 深入了解常見問題集。
其中 \u70e7 是 “燒” 的 Unicode 編碼,\u9915 是 “餅” 的 Unicode 編碼,\u6cb9 是 “油” 的 Unicode 編碼,\u6a1e 是 “條” 的 Unicode 編碼。
檢查文本替換選項:您在程式中設置了文本替換選項,請確保這些選項不會影響中文字符的替換。您可以嘗試移除以下行:

textReplaceOptions.ReplaceType = PdfTextReplaceOptions.ReplaceActionType.IgnoreCase;
textReplaceOptions.ReplaceType = PdfTextReplaceOptions.ReplaceActionType.WholeWord;
textReplaceOptions.ReplaceType = PdfTextReplaceOptions.ReplaceActionType.AutofitWidth;

AI 產生的代碼。請仔細檢視及使用。 深入了解常見問題集。
然後再次執行您的程式。
如果您仍然遇到問題,建議您查閱 FreeSpire.PDF 的官方文檔或諮詢其社區討論區,以獲得更詳細的幫助。123

********************************************************************************


懷疑不支援中文,或中文還需要額外的設定,暫時不知如何處理。

(待續)

相關

[研究]ASP.NET,試用FreeSpire.PDF 10.2.0 取代 .pdf 中的文字
https://shaurong.blogspot.com/2024/05/aspnetfreespirepdf-1020-pdf.html

[研究]ASP.NET,試用FreeSpire.PDF 8.6.0、10.2.0 產生 .pdf 檔案
https://shaurong.blogspot.com/2024/05/aspnetfreespirepdf-8601020.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 取代 .docx 中的文字
https://shaurong.blogspot.com/2024/05/caspnet-freespiredoc-1220-docx.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 把 .docx 轉成 .pdf
https://shaurong.blogspot.com/2024/05/caspnet-freespiredoc-1220-docx-pdf.html

[研究]FreeSpire.PDF 6.2.60 升級 7.8.9 後出錯,warning CS0618: 'PdfTextFind.Bounds' 已經過時: 'This property may be removed in the future, please use TextBounds instead.'
https://shaurong.blogspot.com/2021/08/warning-cs0618-pdftextfindbounds-this.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 7.11.0 取代 .docx 中的文字
https://shaurong.blogspot.com/2020/06/caspnet-freespiredoc-7110-docx.html

[研究][C#][ASP.NET] 使用 Free Spire.PDF for NET v6.2.0 取代 .pdf 中的文字
https://shaurong.blogspot.com/2020/06/caspnet-free-spirepdf-for-net-v620-pdf.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 7.11.0 把 .docx 轉成 .pdf
https://shaurong.blogspot.com/2020/06/caspnet-spiredoc-docx-pdf.html

[研究][C#][ASP.NET] 免費 Free Spire.PDF for .NET 3.2.0 試用 Url to pdf 檔案 (NuGet 安裝)
https://shaurong.blogspot.com/2018/03/aspnet-free-spirepdf-for-net-pdf.html

[研究][C#][ASP.NET] 免費 PDFsharp v1.32.3057.0 產生 pdf 試用 (NuGet 安裝)
https://shaurong.blogspot.com/2018/03/caspnet-pdfsharp-v13230570-pdf-nuget.html

[研究]ASP.NET,試用FreeSpire.PDF 8.6.0、10.2.0 產生 .pdf 檔案

[研究]ASP.NET,試用FreeSpire.PDF 8.6.0、10.2.0 產生 .pdf 檔案

2024-04-30

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

********************************************************************************

NuGet Gallery | FreeSpire.PDF
https://www.nuget.org/packages/FreeSpire.PDF

Free .NET PDF API - Developing PDF in C#, VB.NET, ASP.NET
https://www.e-iceblue.com/Introduce/free-pdf-component.html

授權 License

Free Spire.PDF for .NET is a Community Edition of the Spire.PDF for .NET, which is a totally free PDF API for commercial and personal use. As a standalone .NET library, Free Spire.PDF for .NET enables developers to create, write, edit, convert, print, handle and read PDF files on any .NET( C#, VB.NET, ASP.NET, .NET Core) applications.

Free version is limited to 10 pages of PDF. This limitation is enforced during writing PDF. When converting PDF to Image, XPS, Word, HTML, you can only get the first 3 pages of file. We don't provide technical or any other support to the users of the free versions.

********************************************************************************




Default.aspx

<asp:Button ID="btnGeneratePDF" runat="server" Text="Generate PDF" OnClick="btnGeneratePDF_Click" />

Default.aspx.cs

using Spire.Pdf;    // PdfDocument 使用
using Spire.Pdf.Graphics;   // PdfFont 使用
using System;
using System.Drawing;   // PointF 使用

protected void btnGeneratePDF_Click(object sender, EventArgs e)
{
    // 創建 PDF 文件
    PdfDocument doc = new PdfDocument();

    // 添加頁面
    PdfPageBase page = doc.Pages.Add();

    // 繪製文字到頁面
    page.Canvas.DrawString("Hello, World!", new PdfFont(PdfFontFamily.Helvetica, 20f), PdfBrushes.Black, new PointF(100, 100));

    // 儲存 PDF
    string filePath = Server.MapPath("~/GeneratedPDFs/Example.pdf");
    doc.SaveToFile(filePath);
    doc.Close();

    // 下載 PDF
    Response.ContentType = "application/pdf";
    Response.AppendHeader("Content-Disposition", "attachment; filename=Example.pdf");
    Response.TransmitFile(filePath);
    Response.End();
}




實際測試,FreeSpire.PDF 8.6.0 此測試程式可用,

把 FreeSpire.PDF 8.6.0 升級到 FreeSpire.PDF 10.2.0 後,也可使用。

(完)

相關

[研究]ASP.NET,試用FreeSpire.PDF 8.6.0、10.2.0 產生 .pdf 檔案
https://shaurong.blogspot.com/2024/05/aspnetfreespirepdf-8601020.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 取代 .docx 中的文字
https://shaurong.blogspot.com/2024/05/caspnet-freespiredoc-1220-docx.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 把 .docx 轉成 .pdf
https://shaurong.blogspot.com/2024/05/caspnet-freespiredoc-1220-docx-pdf.html

[研究]FreeSpire.PDF 6.2.60 升級 7.8.9 後出錯,warning CS0618: 'PdfTextFind.Bounds' 已經過時: 'This property may be removed in the future, please use TextBounds instead.'
https://shaurong.blogspot.com/2021/08/warning-cs0618-pdftextfindbounds-this.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 7.11.0 取代 .docx 中的文字
https://shaurong.blogspot.com/2020/06/caspnet-freespiredoc-7110-docx.html

[研究][C#][ASP.NET] 使用 Free Spire.PDF for NET v6.2.0 取代 .pdf 中的文字
https://shaurong.blogspot.com/2020/06/caspnet-free-spirepdf-for-net-v620-pdf.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 7.11.0 把 .docx 轉成 .pdf
https://shaurong.blogspot.com/2020/06/caspnet-spiredoc-docx-pdf.html

[研究][C#][ASP.NET] 免費 Free Spire.PDF for .NET 3.2.0 試用 Url to pdf 檔案 (NuGet 安裝)
https://shaurong.blogspot.com/2018/03/aspnet-free-spirepdf-for-net-pdf.html

[研究][C#][ASP.NET] 免費 PDFsharp v1.32.3057.0 產生 pdf 試用 (NuGet 安裝)
https://shaurong.blogspot.com/2018/03/caspnet-pdfsharp-v13230570-pdf-nuget.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 取代 .docx 中的文字

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 取代 .docx 中的文字

2024-05-01

Visual Studio 2019 v16.6.1 + WebForm + WebApplication
Nuget 安裝 FreeSpire.Doc 7.11.0 元件 (不是 Spire.Doc )

官方網站

免費版有篇幅限制。在加載或操作 Word 文檔時,要求 Word 文檔不超過 500 個段落,25 個表格。同時將 Word 文檔轉換為 PDF 和 XPS 格式時,僅支持轉換前三頁。

Free Spire.Doc for .NET is a Community Edition of the Spire.Doc for .NET, which is a totally free word API for commercial and personal use. As a free C#/VB.NET API, it also offers a lot of powerful functions. Developers can use it to generate, read, write, save and convert documents on any .NET applications. The featured function, conversion allows converting Word documents (Word 97-2003, Word 2007, Word 2010, Word 2013 and Word 2016) to commonly used file format, such as XML, RTF, TXT, PDF, XPS, EPUB, HTML and Image etc.

Friendly Reminder:
Free version is limited to 500 paragraphs and 25 tables. This limitation is enforced during reading or writing files. When converting word documents to PDF and XPS files, you can only get the first 3 page of PDF file. Upgrade to Commercial Edition of Spire.Doc

參考
https://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/How-to-Convert-Word-to-PDF.html

********************************************************************************


WebApplication1

正在安裝:

System.Buffers.4.4.0
System.Numerics.Vectors.4.4.0
System.Runtime.CompilerServices.Unsafe.4.5.2
System.Memory.4.5.3
HarfBuzzSharp.2.6.1.5
FreeSpire.Doc.12.2.0

********************************************************************************

Default.aspx

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

<!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>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
        </div>
    </form>
</body>
</html>


Default.aspx.cs

using Spire.Doc;
using System;

namespace SpireDocDemo
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Document document = new Document();

            document.LoadFromFile(@"C:\Temp\test.docx"); 
            document.Replace("Hello", "HHeelllloo", false, true);

            document.SaveToFile(@"C:\Temp\test2.docx", FileFormat.Docx);
        }
    }
}






實際測試,FreeSpire.Doc 7.11.0 和 FreeSpire.Doc 12.2.0 都可以使用。

(完)

相關

[研究]ASP.NET,試用FreeSpire.PDF 8.6.0、10.2.0
https://shaurong.blogspot.com/2024/05/aspnetfreespirepdf-8601020.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 取代 .docx 中的文字
https://shaurong.blogspot.com/2024/05/caspnet-freespiredoc-1220-docx.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 把 .docx 轉成 .pdf
https://shaurong.blogspot.com/2024/05/caspnet-freespiredoc-1220-docx-pdf.html

[研究]FreeSpire.PDF 6.2.60 升級 7.8.9 後出錯,warning CS0618: 'PdfTextFind.Bounds' 已經過時: 'This property may be removed in the future, please use TextBounds instead.'
https://shaurong.blogspot.com/2021/08/warning-cs0618-pdftextfindbounds-this.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 7.11.0 取代 .docx 中的文字
https://shaurong.blogspot.com/2020/06/caspnet-freespiredoc-7110-docx.html

[研究][C#][ASP.NET] 使用 Free Spire.PDF for NET v6.2.0 取代 .pdf 中的文字
https://shaurong.blogspot.com/2020/06/caspnet-free-spirepdf-for-net-v620-pdf.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 7.11.0 把 .docx 轉成 .pdf
https://shaurong.blogspot.com/2020/06/caspnet-spiredoc-docx-pdf.html

[研究][C#][ASP.NET] 免費 Free Spire.PDF for .NET 3.2.0 試用 Url to pdf 檔案 (NuGet 安裝)
https://shaurong.blogspot.com/2018/03/aspnet-free-spirepdf-for-net-pdf.html

[研究][C#][ASP.NET] 免費 PDFsharp v1.32.3057.0 產生 pdf 試用 (NuGet 安裝)
https://shaurong.blogspot.com/2018/03/caspnet-pdfsharp-v13230570-pdf-nuget.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 把 .docx 轉成 .pdf

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 把 .docx 轉成 .pdf

2024-05-01

Visual Studio 2019 v16.6.1 + WebForm + WebApplication
Nuget 安裝 FreeSpire.Doc 7.11.0 元件 (不是 Spire.Doc )

官方網站

免費版有篇幅限制。在加載或操作 Word 文檔時,要求 Word 文檔不超過 500 個段落,25 個表格。同時將 Word 文檔轉換為 PDF 和 XPS 格式時,僅支持轉換前三頁。

Free Spire.Doc for .NET is a Community Edition of the Spire.Doc for .NET, which is a totally free word API for commercial and personal use. As a free C#/VB.NET API, it also offers a lot of powerful functions. Developers can use it to generate, read, write, save and convert documents on any .NET applications. The featured function, conversion allows converting Word documents (Word 97-2003, Word 2007, Word 2010, Word 2013 and Word 2016) to commonly used file format, such as XML, RTF, TXT, PDF, XPS, EPUB, HTML and Image etc.

Friendly Reminder:
Free version is limited to 500 paragraphs and 25 tables. This limitation is enforced during reading or writing files. When converting word documents to PDF and XPS files, you can only get the first 3 page of PDF file. Upgrade to Commercial Edition of Spire.Doc

參考
https://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/How-to-Convert-Word-to-PDF.html

********************************************************************************


WebApplication1

正在安裝:

System.Buffers.4.4.0
System.Numerics.Vectors.4.4.0
System.Runtime.CompilerServices.Unsafe.4.5.2
System.Memory.4.5.3
HarfBuzzSharp.2.6.1.5
FreeSpire.Doc.12.2.0

********************************************************************************

Default.aspx

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

<!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>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
        </div>
    </form>
</body>
</html>


Default.aspx.cs

using Spire.Doc;
using System;

namespace SpireDocDemo
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //Load Document
            Document document = new Document();
            document.LoadFromFile(@"C:\temp\test.docx");

            //Convert Word to PDF
            document.SaveToFile(@"C:\temp\testt.pdf", Spire.Doc.FileFormat.PDF);

            //Launch Document
            System.Diagnostics.Process.Start(@"C:\temp\testt.pdf");
        }
    }
}





實際測試,FreeSpire.Doc 7.11.0 和 FreeSpire.Doc 12.2.0 都可以使用。

(完)

相關

[研究]ASP.NET,試用FreeSpire.PDF 8.6.0、10.2.0
https://shaurong.blogspot.com/2024/05/aspnetfreespirepdf-8601020.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 取代 .docx 中的文字
https://shaurong.blogspot.com/2024/05/caspnet-freespiredoc-1220-docx.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 12.2.0 把 .docx 轉成 .pdf
https://shaurong.blogspot.com/2024/05/caspnet-freespiredoc-1220-docx-pdf.html

[研究]FreeSpire.PDF 6.2.60 升級 7.8.9 後出錯,warning CS0618: 'PdfTextFind.Bounds' 已經過時: 'This property may be removed in the future, please use TextBounds instead.'
https://shaurong.blogspot.com/2021/08/warning-cs0618-pdftextfindbounds-this.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 7.11.0 取代 .docx 中的文字
https://shaurong.blogspot.com/2020/06/caspnet-freespiredoc-7110-docx.html

[研究][C#][ASP.NET] 使用 Free Spire.PDF for NET v6.2.0 取代 .pdf 中的文字
https://shaurong.blogspot.com/2020/06/caspnet-free-spirepdf-for-net-v620-pdf.html

[研究][C#][ASP.NET] 使用 FreeSpire.Doc 7.11.0 把 .docx 轉成 .pdf
https://shaurong.blogspot.com/2020/06/caspnet-spiredoc-docx-pdf.html

[研究][C#][ASP.NET] 免費 Free Spire.PDF for .NET 3.2.0 試用 Url to pdf 檔案 (NuGet 安裝)
https://shaurong.blogspot.com/2018/03/aspnet-free-spirepdf-for-net-pdf.html

[研究][C#][ASP.NET] 免費 PDFsharp v1.32.3057.0 產生 pdf 試用 (NuGet 安裝)
https://shaurong.blogspot.com/2018/03/caspnet-pdfsharp-v13230570-pdf-nuget.html

2024年4月30日 星期二

[研究]ASP.NET,試用 NReco.PdfGenerator 1.2.1 把 html 轉 pdf

[研究]ASP.NET,試用 NReco.PdfGenerator 1.2.1 把 html 轉 pdf

2024-04-30

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

NuGet Gallery | NReco.PdfGenerator 1.2.1
https://www.nuget.org/packages/NReco.PdfGenerator

Convert HTML to PDF in C#/.NET with NReco.PdfGenerator (FREE)
https://www.nrecosite.com/pdf_generator_net.aspx

線上說明
https://www.nrecosite.com/doc/NReco.PdfGenerator/

授權:1. Can I use PdfGenerator in my commercial project for FREE?

NReco.PdfGenerator can be used for FREE in .NET apps that have only one single-server production deployment.

A commercial license is required for:

  • Applications with multiple deployments, or one multi-server production deployment
  • SaaS apps

官方範例

Convert HTML to PDF in your C# code:

var htmlContent = String.Format("<body>Hello world: {0}</body>", 
		DateTime.Now);
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
var pdfBytes = htmlToPdf.GeneratePdf(htmlContent);

Create PDF from HTML file or URL:

htmlToPdf.GeneratePdfFromFile("http://www.nrecosite.com/", null, "export.pdf");  

********************************************************************************

NuGet 安裝 NReco.PdfGenerator 1.2.1 並沒有相依套件。

Default.aspx

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

<!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>
</head>
<body>
    <form id="form1" runat="server">
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
    </form>
</body>
</html>



Default.aspx.cs

using System;

namespace WebApplication1
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
			System.Text.StringBuilder html = new System.Text.StringBuilder();
			
			html.Append("<html>");
			html.Append("<head>");
			html.Append("<meta charset='utf-8' />");
			html.Append("<title>無標題文件</title>");
			html.Append(@"<style>
body {
	margin: 0px;
	padding: 0px;
}

.Paper {
	width: 1000px;
	margin-right: auto;
	margin-left: auto;
}
</style>"); html.Append("</head>");
			html.Append("<body>");
			html.Append("<div class='Paper'>");
			// h1 不可有「報名表」,否則產出的 .pdf 索引會變成「報吊表」
			//html.Append("<h1 style ='text-align:center'>報名表</h1>");
			// 若用 h1、h2、、等,產生的 .pdf 會有書籤定位點,「報名表」在書籤定位點會顯示成「報吊表」,故改用 div
			html.Append("<div style ='text-align:center; font-size:xx-large'>報名表</div>");

			string FName = "test.pdf";

			var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
			var pdfBytes = htmlToPdf.GeneratePdf(html.ToString());
			//Response給用戶端下載
			Response.Clear();
			Response.AddHeader("content-disposition", "attachment; filename=" + FName);//強制下載
			Response.ContentType = "application/octet-stream";
			Response.BinaryWrite(pdfBytes);
		}
	}
}




(完)

相關