顯示具有 Aspose 標籤的文章。 顯示所有文章
顯示具有 Aspose 標籤的文章。 顯示所有文章

2025年10月27日 星期一

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

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

2025-10-27

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

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

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

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

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

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

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

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


下圖,評估版無法真正顯示內容;有商業付費 License 後則可以。


(完)

相關

(完)

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 檔案路徑
        }
    }
}



(完)

相關

(完)

2022年4月4日 星期一

[研究]Aspose 元件過期

[研究]Aspose 元件過期

2022-04-04

The subscription included in this license allows free upgrades until 16 Jul 2021, but this version of the product was released on 14 Oct 2021. Please renew the subscription or use a previous version of the product.

(完)

2020年5月21日 星期四

[研究] [C#][ASP.NET] 使用 Aspose.Cells 20.6.0 讀寫 LibreOffice、OpenOffice 試算表(Calc) ODF 檔案 (.ods)

[研究] [C#][ASP.NET] 使用 Aspose.Cells 20.6 讀寫 LibreOffice、OpenOffice 試算表(Calc) ODF 檔案 (.ods)

2020-05-21
2020-06-18 更新

Aspose.Cells for .NET - Evaluation Version Limitations
Aspose.Cells 是商業付費軟體,但有試用版,有下面限制。
* 100 次 excel 開檔限制
* 組態設定限制
* 使用中工作表設定

參考

Download The Aspose Pty Ltd End User License Agreement
http://www.aspose.com/corporate/purchase/end-user-license-agreement.aspx

.NET APIs to manipulate Excel spreadsheets
http://www.aspose.com/products/cells/net
支援的輸入、輸出格式

Opening Files
http://www.aspose.com/docs/display/cellsnet/Opening+Files
各種開啟檔案方法

Save ODS File in ODF 1.1 and 1.2 Specifications
http://www.aspose.com/docs/display/cellsnet/Save+ODS+File+in+ODF+1.1+and+1.2+Specifications
寫入 .ods 版本 1.1 和 1.2 方法

設定授權檔案方法
各種範例

開放文件格式(Open Document Format,簡稱ODF)
測試用的 .ods 可以用 Excel 去建立,另存成 .ods 檔案。

Visual Studio 2019 v16.6.0
ASP.NET +  WinForm + WebApplication

NuGet 安裝 Aspose.Cells 的  20.6.0 版,實際測試可用。

Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" 
Inherits="WebApplicationAposeCell1.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" />
            <br />
            <asp:Label ID="Label1" runat="server" ></asp:Label>
        </div>
    </form>
</body>
</html>

Default.aspx.cs

using Aspose.Cells;
using System;
using System.IO;

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

        }
        // http://www.aspose.com/docs/display/cellsnet/Opening+Files
        protected void Button1_Click(object sender, EventArgs e)
        {
            using (FileStream fs = File.Open(@"C:\\Temp\\活頁簿1.ods", FileMode.Open))
            {
                Workbook workbook = new Workbook(fs);
                Cell cell = workbook.Worksheets[0].Cells["A1"];
                Label1.Text = cell.Value.ToString();
            }
        }
    }
}







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

改寫,增加寫入功能測試。

注意,此測試寫入 C:\temp 目錄,故此目錄必須開放讓 IIS_IUSRS 使用者有寫入權限。

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplicationAposeCell1.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" />
            &nbsp;
                        <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" />
            <br />
            <asp:Label ID="Label1" runat="server" ></asp:Label>
        </div>
    </form>
</body>
</html>



Default.aspx.cs

using Aspose.Cells;
using System;
using System.IO;

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

        protected void Button1_Click(object sender, EventArgs e)
        {
            using (FileStream fs = File.Open(@"C:\\Temp\\活頁簿1.ods", FileMode.Open))
            {
                Workbook workbook = new Workbook(fs);
                Cell cell = workbook.Worksheets[0].Cells["A1"];
                Label1.Text = cell.Value.ToString();
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
                // The path to the documents directory.
                //string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                string dataDir = @"C:\temp\";

                // Create workbook
                Workbook workbook = new Workbook();

                // Access first worksheet
                Worksheet worksheet = workbook.Worksheets[0];

                // Put some value in cell A1
                Cell cell = worksheet.Cells["A1"];
                cell.PutValue("Welcome to Aspose!");

                // Save ODS in ODF 1.2 version which is default
                OdsSaveOptions options = new OdsSaveOptions();
                workbook.Save(dataDir + "ODF1.2_out.ods", options);

                // https://docs.aspose.com/display/cellsnet/Different+Ways+to+Save+Files
                // Save ODS in ODF 1.1 version
                options.IsStrictSchema11 = true;
                workbook.Save(dataDir + "ODF1.1_out.ods", options);
                // Save in Excel 97 ~ 2003 format
                workbook.Save(dataDir + ".output.xls");
                // OR
                workbook.Save(dataDir + ".output..xls", new XlsSaveOptions(SaveFormat.Excel97To2003));

                // Save in Excel2007 xlsx format
                workbook.Save(dataDir + ".output.xlsx", SaveFormat.Xlsx);

                // Save in Excel2007 xlsb format
                workbook.Save(dataDir + ".output.xlsb", SaveFormat.Xlsb);

                // Save in ODS format
                workbook.Save(dataDir + ".output.ods", SaveFormat.ODS);

                // Save in Pdf format
                workbook.Save(dataDir + ".output.pdf", SaveFormat.Pdf);

                // Save in Html format
                workbook.Save(dataDir + ".output.html", SaveFormat.Html);

                // Save in SpreadsheetML format
                workbook.Save(dataDir + ".output.xml", SaveFormat.SpreadsheetML);
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message.ToString();
            }
        }
    }
}



如果要輸出不同格式檔案,可參考。

測試結果。




(完)

相關

[研究] [C#][Windows Forms] 使用 Aspose.Cells 讀取 LibreOffice 5.1.6、OpenOffice 4.1.3 試算表(Calc) 檔案 (.ods)