从COM加载项设置MS Word 2010文档名称
我正在搜索一种方法,从COM插件在Ms Word 2010的从COM加载项设置MS Word 2010文档名称,com,ms-word,add-in,document,Com,Ms Word,Add In,Document,我正在搜索一种方法,从COM插件在Ms Word 2010的SaveAs对话框中预设建议的文件名。(此外,我还想设置默认存储路径,但这只是次要的。) 我使用的是word的默认SaveAscommandButton,因为文件应该存储在SharePoint环境中,而.NetSaveFileDialog不支持这一点。我正在使用的代码: var match = Application.CommandBars.FindControl( MsoControlType.
SaveAs
对话框中预设建议的文件名。(此外,我还想设置默认存储路径,但这只是次要的。)
我使用的是word的默认SaveAs
commandButton
,因为文件应该存储在SharePoint环境中,而.NetSaveFileDialog
不支持这一点。我正在使用的代码:
var match = Application.CommandBars.FindControl(
MsoControlType.msoControlButton, 748, null, null);
match.Execute();
我尝试过的事情:
和Application.Document.Name
属性只提供getter,因此无法设置它们(为什么,我无法想象)FullName
- 搜索可在Word设置中设置的默认
(因此将其设置为某个值,然后稍后再还原)文件名
- 检查是否有其他API操作可用于设置文档名称
- 一个非常糟糕的解决方案是使用
操作将文档存储到临时目录,因此在执行document.SaveAs(“fileName.doc”)
按钮时,名称已经设置好SaveAs
克里斯如果我正确理解了你的问题,这对我很有用。使用VS2010和Office 2010
Microsoft.Office.Interop.Word._Document objWordDocument;
object objMissing = System.Reflection.Missing.Value;
objWordDocument = objWordApplication.Documents.Add(ref objMissing, ref objMissing, ref objMissing, ref objMissing);
objWordDocument.Activate();
objWordDocument.ActiveWindow.Caption = "CallMeWhatYouWill";