因為自己是VBA的忠實用戶工扎,自從參合RPA后也沒怎么在意自動化產(chǎn)品提供的office操作功能昆禽。
大部分時候?qū)慥BA或者vbs搞定自動化的部分贡翘。
最近突然犯懶事富,想用RPA自帶功能了。
話說Uipath的自帶excel功能真的很多吏口。。冰更。
image.png
BluePrism附送(得自己按需導入)的object功能表示自家更厲害产徊。。蜀细。
image.png
AA的如下:
image.png
嗯囚痴,AA的自帶功能確實。审葬。深滚。還好AA有metabot奕谭,You can you up^^
跑到bot store看了下,Excel部分的metabot有是有痴荐,下載后發(fā)現(xiàn)用不了比如其實是個空文件什么的血柳。可能過幾天才能有生兆?
還是自給自足吧难捌。。鸦难。
大致思路是使用來自微軟的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