Midoliy.Office.Interop.Excel 0.0.6.42

.NET 5.0 .NET Framework 4.0
Install-Package Midoliy.Office.Interop.Excel -Version 0.0.6.42
dotnet add package Midoliy.Office.Interop.Excel --version 0.0.6.42
<PackageReference Include="Midoliy.Office.Interop.Excel" Version="0.0.6.42" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Midoliy.Office.Interop.Excel --version 0.0.6.42
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Midoliy.Office.Interop.Excel, 0.0.6.42"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Midoliy.Office.Interop.Excel as a Cake Addin
#addin nuget:?package=Midoliy.Office.Interop.Excel&version=0.0.6.42

// Install Midoliy.Office.Interop.Excel as a Cake Tool
#tool nuget:?package=Midoliy.Office.Interop.Excel&version=0.0.6.42
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Midoliy.Office.Interop.Excel

はじめに

このライブラリは Excel COM をより使いやすくするためのラッパーライブラリです。
通常、Excel COM を利用する場合は以下のように煩雑なコードを記述する必要があります。

using System.Runtime.InteropServices;
using Excel = Microsoft.Office.Interop.Excel;

class Program
{
    static void Main(string[] args)
    {
        var app = new Excel.Application();
        try
        {
            var book = app.Workbooks.Add();
            try
            {
                var sheet = book.Sheets[1];
                try
                {
                    var cell = sheet.Range["A1"] as Excel.Range;
                    try
                    {
                        cell.Value = 100;
                    }
                    finally
                    {
                        while (0 < Marshal.ReleaseComObject(cell)) { }
                    }
                }
                finally
                {
                    while (0 < Marshal.ReleaseComObject(sheet)) { }
                }
            }
            finally
            {
                while (0 < Marshal.ReleaseComObject(book)) { }
            }
        }
        finally
        {
            app.Visible = true;
            while (0 < Marshal.ReleaseComObject(app)) { }
        }
    }
}

Midoliy.Office.Interop.Excel を利用することで以下のように簡潔に記述することが可能となります。

using Midoliy.Office.Interop;

class Program
{
    static void Main(string[] args)
    {
        using (var app = Excel.BlankWorkbook())
        {
            // appのDispose後にExcelを表示する
            app.Visibility = AppVisibility.Visible;

            // パターン(1)
            app.Workbooks(1).Worksheets(1).Cells("A1").Value = 100;

            // パターン(2)
            app[1][1]["A1"].Value = 100;

            // パターン(1) と パターン(2)を複合させても良い
            app[1].Worksheets(1)["A1"].Value = 100;
        }
    }
}
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Framework net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Midoliy.Office.Interop.Excel:

Package Downloads
Fxcel

Excel COM operation tools for F#

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.6.42 282 8/9/2021
0.0.6.41 126 8/9/2021
0.0.6.40 147 8/9/2021
0.0.6.39 128 8/8/2021
0.0.6.38 139 8/8/2021
0.0.6.37 143 8/8/2021
0.0.6.36 139 8/8/2021
0.0.6.35 140 8/8/2021
0.0.6.34 146 8/8/2021
0.0.6.33 119 8/8/2021
0.0.6.32 130 8/8/2021
0.0.6.31 129 8/8/2021
0.0.6.30 229 7/29/2021
0.0.6.29 197 7/29/2021
0.0.6.28 220 7/29/2021
0.0.6.27 162 7/29/2021
0.0.6.26 160 7/29/2021
0.0.6.25 207 7/29/2021
0.0.6.24 188 7/29/2021
0.0.6.23 180 7/29/2021
0.0.6.22 199 7/29/2021
0.0.6.21 253 7/28/2021
0.0.6.20 207 7/28/2021
0.0.6.19 176 7/28/2021
0.0.6.18 193 7/28/2021
0.0.6.17 246 7/28/2021
0.0.6.16 209 7/27/2021
0.0.6.15 200 7/27/2021
0.0.6.14 360 6/19/2021
0.0.6.13 128 6/19/2021
0.0.6.12 133 6/17/2021
0.0.6.11 145 6/16/2021
0.0.6.10 159 6/16/2021
0.0.6.9 163 6/16/2021
0.0.6.8 171 6/15/2021
0.0.6.7 175 6/13/2021
0.0.6.6 160 6/13/2021
0.0.6.5 134 6/13/2021
0.0.6.4 130 6/13/2021
0.0.6.3 132 6/13/2021
0.0.6.2 132 6/13/2021
0.0.6.1 132 6/13/2021
0.0.6 126 6/12/2021
0.0.5.6 166 5/18/2021
0.0.5.5 311 11/19/2020
0.0.5.4 281 9/28/2020
0.0.5.3 268 9/25/2020
0.0.5.2 296 9/25/2020
0.0.5.1 300 5/10/2020
0.0.5 280 5/10/2020
0.0.4 255 4/24/2020
0.0.3 284 4/20/2020
0.0.2 267 4/19/2020
0.0.1 262 4/19/2020