请教各位大侠, C#向word中插入C#制作的控件并持久化,本人做了一个例子向word中插入自定义控件,但是插入后保存再打开,却不可用,如何让我做的控件透明?HelloWorld.Demo是我用c#做的自定义控件,用来显示公章的。
object LinkToFile = false;
object SaveWithDocument = true;
object Range = System.Reflection.Missing.Value;
object classType = "HelloWorld.Demo";
try
{
new HelloWorld.SealMaking().SealMaked(applicationObject);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Word._Application w = (Word._Application)applicationObject;
w.Visible = true;
try
{
Word.Shape shape =
w.ActiveDocument.Shapes.AddOLEObject(ref classType, ref Range, ref LinkToFile, ref Range, ref Range, ref Range, ref Range, ref Range, ref Range, ref Range, ref Range, ref Range);
shape.WrapFormat.Type = Word.WdWrapType.wdWrapInline;
shape.OLEFormat.Activate();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
object LinkToFile = false;
object SaveWithDocument = true;
object Range = System.Reflection.Missing.Value;
object classType = "HelloWorld.Demo";
try
{
new HelloWorld.SealMaking().SealMaked(applicationObject);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Word._Application w = (Word._Application)applicationObject;
w.Visible = true;
try
{
Word.Shape shape =
w.ActiveDocument.Shapes.AddOLEObject(ref classType, ref Range, ref LinkToFile, ref Range, ref Range, ref Range, ref Range, ref Range, ref Range, ref Range, ref Range, ref Range);
shape.WrapFormat.Type = Word.WdWrapType.wdWrapInline;
shape.OLEFormat.Activate();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}