CustomTaskPaneFactory
의 가장 이상한 문제는 Excel-DNA 0.32
입니다.Excel-DNA - Templated CustomTaskPane 예외
CustomTaskPaneFactory
은 템플릿 작업 창 (MyCTP<T>
)에서 상속받은 클래스 (MyIntCTP
)가있는 작업 창을 만들 때 예외를 throw합니다. 위의 코드가 작동하지 않는
<DnaLibrary RuntimeVersion="v4.0" Language="CS">
<Reference Path="System.Windows.Forms.dll" />
<![CDATA[
using ExcelDna.Integration;
using ExcelDna.Integration.CustomUI;
using System.Windows.Forms;
internal class ThisAddIn : IExcelAddIn
{
public void AutoOpen()
{
var p = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(MyIntCTP), "o");
p.Visible = true;
}
public void AutoClose()
{ }
}
public class MyCTP<T> : UserControl
{ }
public class MyIntCTP : MyCTP<int>
{ }
]]>
</DnaLibrary>
: 여기
컨텍스트를 도시 한 예이다. 다음System.Runtime.InteropServices.COMException
와
CreateCustomTaskPane
에 엑셀 DNA 충돌 :
부모 작업 창 (
MyCTP
는) 인터페이스, 그래서 (모든 클래스가 public으로 표시되어 있습니다) 구현하는 경우이 작업을 수행하지만
Unable to create specified ActiveX control
at ExcelDna.Integration.CustomUI.ICTPFactory.CreateCTP(String CTPAxID, String CTPTitle, Object CTPParentWindow)
at ExcelDna.Integration.CustomUI.CustomTaskPaneFactory.CreateCustomTaskPane(String controlProgId, String title, Object parent)
at ExcelDna.Integration.CustomUI.CustomTaskPaneFactory.CreateCustomTaskPane(Type userControlType, String title, Object parent)
at ExcelDna.Integration.CustomUI.CustomTaskPaneFactory.CreateCustomTaskPane(Type userControlType, String title)
[...]
:
을public interface DummyInterface
{ }
public class MyCTP<T> : UserControl, DummyInterface
{ }
나는 인터페이스가 필요 없지만 템플릿을 유지하려고합니다. 어떤 아이디어?
나는 또한 여기에서 붙어있다. – Hristo