private void DeleteAttachment()
{
// doc.ReplaceItemValue("编译附件", ""); //清空rtf域对象
NotesItem ni = doc.GetFirstItem("编译附件");
NotesRichTextItem nrti = null;
if (ni != null)
{
nrti = ni as NotesRichTextItem; //得到rtf域对象
if (nrti.type == IT_TYPE.RICHTEXT)
{
object O = nrti.EmbeddedObjects;
if (O != null)
{
object[] OO = ((object[])O);
for (int i = 0; i < OO.Length; i++)
{
NotesEmbeddedObject NEmbeddedObject = (NotesEmbeddedObject)(OO[i]);
if (NEmbeddedObject.type==EMBED_TYPE.EMBED_ATTACHMENT)
{
NEmbeddedObject.Remove();
}
}
}
}
}
doc.Save(true, false, false);
}
本文介绍了一种在Lotus Notes应用程序中删除文档内嵌附件的方法。通过获取并遍历编译附件字段中的所有嵌入对象,找到并移除类型为附件的对象。此过程包括定位目标字段、转换为富文本项、获取所有嵌入对象并逐一检查其类型,最终实现附件的删除。
2057

被折叠的 条评论
为什么被折叠?



