Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Commented Issue: AddHostObject works very slowly [68]

0
0
Hi!
AddHostObject works very slowly for an object of type Microsoft.Office.Interop.Excel.Workbook.
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel;

namespace ClearScriptTest
{
class Program
{
static void Main(string[] args)
{
Application ExcelApplication = null;
try
{
ExcelApplication = (Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
}
catch (COMException)
{
Type type = Type.GetTypeFromProgID("Excel.Application");
ExcelApplication = (Application)System.Activator.CreateInstance(type);
}
Workbook ExcelDocument = (Workbook)ExcelApplication.Workbooks.Add();
Microsoft.ClearScript.Windows.VBScriptEngine engine = new Microsoft.ClearScript.Windows.VBScriptEngine();
engine.AddHostObject("ExcelObject", ExcelApplication);
engine.AddHostObject("DocumentObject", ExcelDocument); // Too long
engine.Execute(@"ExcelObject.ScreenUpdating = True
ExcelObject.Visible = True");
}
}
}
```
Can you please have a look?
Thanks!
Comments: Fixed in [Version 5.4.1](https://clearscript.codeplex.com/SourceControl/changeset/c2200cbd6b77300484927906517035caef3ae323).

Viewing all articles
Browse latest Browse all 2297