因为自己是VBA的忠实用户,自从参合RPA后也没怎么在意自动化产品提供的office操作功能。
大部分时候写VBA或者vbs搞定自动化的部分。
最近突然犯懒,想用RPA自带功能了。
话说Uipath的自带excel功能真的很多。。。

image.png
BluePrism附送(得自己按需导入)的object功能表示自家更厉害。。。

image.png
AA的如下:

image.png
嗯,AA的自带功能确实。。。还好AA有metabot,You can you up^^
跑到bot store看了下,Excel部分的metabot有是有,下载后发现用不了比如其实是个空文件什么的。可能过几天才能有?
还是自给自足吧。。。
大致思路是使用来自微软的Microsoft.Office.Interop.Excel.dll,必要时封装其他方法。然后放进metabot作为通用方法处理。
image.png

image.png
相应代码举例:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExcelApp = Microsoft.Office.Interop.Excel.Application;
using System.IO;
namespace excelOperation
{
public class ExcelWrapper
{
public static ExcelApp StartExcel()
{
ExcelApp instance = null;
try
{
instance = (ExcelApp)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
instance.Visible = true;
}
catch (System.Runtime.InteropServices.COMException ex)
{
Console.WriteLine(ex.ToString());
instance = new ExcelApp();
instance.Visible = true;
}
return instance;
}
public static void openFile(String strPath)
{
ExcelApp app = StartExcel();
app.Workbooks.Open(strPath);
}
public static void exitApp()
{
ExcelApp app = StartExcel();
app.Quit();
}
}
}
Metabot的demo function

image.png
好了,这下AA可用方法实在太多,我要捋一捋。。。

image.png