난 다음 COM 개체가 있습니다반사
public interface ParagraphFormat2 : _IMsoDispObj
{
[DispId(2)]
MsoParagraphAlignment Alignment { get; set; }
[DispId(1610743808)]
object Application { get; }
[DispId(3)]
MsoBaselineAlignment BaselineAlignment { get; set; }
[DispId(4)]
BulletFormat2 Bullet { get; }
}
내가 총알 속성을 설정해야합니다, 그래서 반사를 사용하는 것이 피곤하지만, 실패입니다 : 를 - 첫 번째 시도 :
PropertyInfo prop = typeof(Microsoft.Office.Core.ParagraphFormat2)
.GetProperty("Bullet", BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.GetProperty);
if (null != prop && prop.CanWrite)
{
prop.SetValue(objParagraphFormat, bullet, null);
}
두 번째 시도 :
typeof(Microsoft.Office.Core.ParagraphFormat2)
.GetField("Bullet", BindingFlags.PutDispProperty |
BindingFlags.PutRefDispProperty)
.SetValue(objParagraphFormat, new object[] { bullet });
어떻게 할 수 있습니까?
음 'ParagraphFormat2'도 읽기 전용이므로 여기서는 PrtToStructure가 도움이되지 않습니다. – rol