ComAutoWrapper 1.1.5.2
See the version list below for details.
dotnet add package ComAutoWrapper --version 1.1.5.2
NuGet\Install-Package ComAutoWrapper -Version 1.1.5.2
<PackageReference Include="ComAutoWrapper" Version="1.1.5.2" />
<PackageVersion Include="ComAutoWrapper" Version="1.1.5.2" />
<PackageReference Include="ComAutoWrapper" />
paket add ComAutoWrapper --version 1.1.5.2
#r "nuget: ComAutoWrapper, 1.1.5.2"
#:package ComAutoWrapper@1.1.5.2
#addin nuget:?package=ComAutoWrapper&version=1.1.5.2
#tool nuget:?package=ComAutoWrapper&version=1.1.5.2
ComAutoWrapper
ComAutoWrapper is a lightweight, zero-Interop, fluent C# helper library for automating COM objects such as Excel and Word — without relying on bulky Primary Interop Assemblies (PIAs).
✔️ Fully dynamic
✔️ Typed property/method access
✔️ Introspectable
✔️ Ideal for WPF / Console / WinForms projects
✔️ Just ~30 KB compiled DLL
🚀 Features
- No Interop DLLs needed
- Lightweight COM helper for C#
- Elegant dynamic wrappers:
GetProperty<T>()
,SetProperty()
CallMethod<T>()
- COM introspection (
ComTypeInspector
) - Excel selection utilities (
ComSelectionHelper
) - Safe release of COM objects
- Compatible with: .NET 6, 7, 8, 9+
🧠 Examples
Get/Set COM Properties
var excel = Activator.CreateInstance(Type.GetTypeFromProgID("Excel.Application")!);
ComInvoker.SetProperty(excel, "Visible", true);
var workbooks = ComInvoker.GetProperty<object>(excel, "Workbooks");
var workbook = ComInvoker.CallMethod<object>(workbooks, "Add");
Invoke COM Methods
var sheet = ComInvoker.GetProperty<object>(workbook, "ActiveSheet");
var cell = ComInvoker.GetProperty<object>(sheet, "Cells");
ComInvoker.SetProperty(cell, "Item", new object[] { 1, 1 }, "Hello");
Introspect COM Object
var (methods, propsGet, propsSet) = ComTypeInspector.ListMembers(sheet);
Console.WriteLine("Available methods:");
methods.ForEach(Console.WriteLine);
✨ Excel-Specific Helpers (Optional)
Provided via the built-in ComSelectionHelper
:
Method | Description |
---|---|
SelectCells(excel, sheet, "A1", "B3", "C5") |
Selects non-contiguous Excel cells |
GetSelectedCellCoordinates(excel) |
Returns (row, column) for each selected cell |
HighlightUsedRange(sheet) |
Highlights the used range with color |
These helpers abstract away the quirks of Excel's COM object model.
📦 NuGet Package
Install via CLI:
dotnet add package ComAutoWrapper
Or via Visual Studio NuGet UI.
💻 Requirements
- Windows OS (COM-based)
- .NET 6 / 7 / 8 / 9
- Microsoft Excel/Word must be installed
The library does not embed Interop DLLs. It uses late binding with proper error handling.
🔗 Related Project
- ComAutoWrapperDemo (GitHub)
WPF demo showcasing full Excel and Word automation using this wrapper.
📊 Comparison: OpenXML vs COM Automation
Feature | OpenXML SDK | ComAutoWrapper |
---|---|---|
Requires Excel Installed | ❌ | ✅ |
Works on Locked/Password Files | ❌ | ✅ |
Manipulate Active Excel Instance | ❌ | ✅ |
Word Automation | ❌ | ✅ |
File Size (DLL) | >10 MB | ~30 KB |
API Simplicity | Moderate | High (fluent & dynamic) |
Cell Selection / UI Interaction | ❌ | ✅ |
UsedRange / Borders / Colors | ❌ | ✅ |
🙏 Acknowledgment
This library is the result of an iterative collaboration between the author and ChatGPT.
Special thanks to all early testers and contributors who shaped the API.
📄 License
MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.1.5.5 | 163 | 7/26/2025 |
1.1.5.4 | 491 | 7/23/2025 |
1.1.5.3 | 190 | 7/20/2025 |
1.1.5.2 | 29 | 7/19/2025 |
1.1.5.1 | 24 | 7/19/2025 |
1.1.5 | 28 | 7/19/2025 |
1.1.4 | 122 | 7/16/2025 |
1.1.3.2 | 138 | 7/15/2025 |
1.1.3.1 | 108 | 7/12/2025 |
1.1.3 | 97 | 7/12/2025 |
1.1.2 | 141 | 7/10/2025 |
1.1.1 | 147 | 7/6/2025 |
1.1.0 | 143 | 6/23/2025 |
1.0.0 | 144 | 6/23/2025 |