[英]An invalid character was found when trying to add multiple MailMessage.To addresses
[英]"Invalid paramenters" when trying to add Buildingblock in Word 2016
当我尝试在 Word 2016 中添加构建块时,我得到无效参数。
范围是表格中的一个单元格(最后一行的第一个单元格)。 Activedocument 是我想添加构建块的模板。
private void CreateNewBuildingblock(string sBuildingblockName)
{
Document currentDocument = Globals.ThisAddIn.Application.ActiveDocument;
Template templateFile = (Template) currentDocument.get_AttachedTemplate();
currentDocument.Tables[1]
.Cell(currentDocument.Tables[1].Rows.Count, 1)
.Range.Text.Substring(
0,
currentDocument.Tables[1]
.Cell(currentDocument.Tables[1].Rows.Count, 1)
.Range.Text.Length - 2
);
Range rBuildingblockContent = Globals.ThisAddIn.Application.Selection.Range;
_ = templateFile.BuildingBlockEntries.Add(
Name: sBuildingblockName,
Type: WdBuildingBlockTypes.wdTypeCustom1,
Category: "Generals",
Range: rBuildingblockContent,
Description: "AV_Buildingblock",
InsertOptions: WdDocPartInsertOptions.wdInsertParagraph
);
}
任何建议/帮助表示赞赏!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.