VbaModuleCollection
内容
[
隐藏
]VbaModuleCollection class
代表列表VbaModule
public class VbaModuleCollection : CollectionBase<VbaModule>
特性
| 姓名 | 描述 |
|---|---|
| Capacity { get; set; } | |
| Count { get; } | |
| Item { get; } | 获取VbaModule在索引列表中。 (2 indexers) |
| Item { get; set; } |
方法
| 姓名 | 描述 |
|---|---|
| Add(Worksheet) | 为工作表添加模块。 |
| Add(VbaModuleType, string) | 添加模块。 |
| AddDesignerStorage(string, byte[]) | |
| BinarySearch(VbaModule) | |
| BinarySearch(VbaModule, IComparer<VbaModule>) | |
| BinarySearch(int, int, VbaModule, IComparer<VbaModule>) | |
| Clear() | |
| Contains(VbaModule) | |
| CopyTo(VbaModule[]) | |
| CopyTo(VbaModule[], int) | |
| CopyTo(int, VbaModule[], int, int) | |
| Exists(Predicate<VbaModule>) | |
| Find(Predicate<VbaModule>) | |
| FindAll(Predicate<VbaModule>) | |
| FindIndex(Predicate<VbaModule>) | |
| FindIndex(int, Predicate<VbaModule>) | |
| FindIndex(int, int, Predicate<VbaModule>) | |
| FindLast(Predicate<VbaModule>) | |
| FindLastIndex(Predicate<VbaModule>) | |
| FindLastIndex(int, Predicate<VbaModule>) | |
| FindLastIndex(int, int, Predicate<VbaModule>) | |
| GetDesignerStorage(string) | 代表 Designer 的数据。 |
| GetEnumerator() | |
| IndexOf(VbaModule) | |
| IndexOf(VbaModule, int) | |
| IndexOf(VbaModule, int, int) | |
| LastIndexOf(VbaModule) | |
| LastIndexOf(VbaModule, int) | |
| LastIndexOf(VbaModule, int, int) | |
| Remove(string) | 按名称删除模块 |
| Remove(Worksheet) | 删除工作表的模块。 |
| RemoveAt(int) |
例子
[C#]
//实例化一个工作簿对象
Workbook workbook = new Workbook();
// 初始化 VBA 项目。
VbaProject vbaProject = workbook.VbaProject;
// 添加一个新模块。
vbaProject.Modules.Add(VbaModuleType.Class, "test");
//保存Excel文件
workbook.Save("book1.xlsm");
[Visual Basic]
'实例化工作簿对象
Dim workbook As Workbook = New Workbook()
'初始化 VBA 项目。
Dim vbaProject as VbaProject = workbook.VbaProject
'添加一个新模块。
vbaProject.Modules.Add(VbaModuleType.Class, "test")
'保存 Excel 文件
workbook.Save("book1.xlsm")
也可以看看
- class CollectionBase<T>
- class VbaModule
- 命名空间 Aspose.Cells.Vba
- 部件 Aspose.Cells