Minimalista, könnyen használható .NET wrapper COM automatizáláshoz (Excel, Word, stb.). Magas szintű metódusokkal, erőforráskezeléssel és introspekcióval.
$ dotnet add package ComAutoWrapperComAutoWrapper 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
GetProperty<T>(), SetProperty()CallMethod<T>()ComTypeInspector)ComSelectionHelper)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");
var sheet = ComInvoker.GetProperty<object>(workbook, "ActiveSheet");
var cell = ComInvoker.GetProperty<object>(sheet, "Cells");
ComInvoker.SetProperty(cell, "Item", new object[] { 1, 1 }, "Hello");
var (methods, propsGet, propsSet) = ComTypeInspector.ListMembers(sheet);
Console.WriteLine("Available methods:");
methods.ForEach(Console.WriteLine);
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.
Install via CLI:
dotnet add package ComAutoWrapperOr via Visual Studio NuGet UI.
The library does not embed Interop DLLs. It uses late binding with proper error handling.
| 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 | ❌ | ✅ |
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.
MIT