如何从添加的Windows窗体中保存word文档? [英] How to save a word document from a windows form in an add in?

查看:91
本文介绍了如何从添加的Windows窗体中保存word文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Word Addin打开一个Windows窗体。在提交表单时,它将创建一个XML。我想保存与XML文档同名的单词。该名称将具有GUID。我想首先保存XML然后单词。



保存格式 - >

< aaa> _< doctype> _< guid> .xml

< aaa> _< doctype> _< guid> .docx

aaa = companycode(数据在Windows窗体中可用),

doctype = doc的文档类型(数据以windows格式提供),



请指教..



我尝试过:



成功保存XML。

I have a Word Addin which opens a Windows Form. On submitting the form it will create a XML. I want to save the word with the same name as the XML document. The name will have a GUID. I want to save the XML first then the word.

Save Format ->
<aaa>_<doctype>_<guid>.xml
<aaa>_<doctype>_<guid>.docx
aaa=companycode (data is available in the windows form),
doctype=document type of the doc(data is available in the windows form),

Please advise..

What I have tried:

Successfully able to save the XML.

推荐答案

Path.ChangeExtension(String,String)方法(System.IO)| Microsoft Docs [ ^ ]

Path.ChangeExtension(String, String) Method (System.IO) | Microsoft Docs[^]
string documentFileName = Path.ChangeExtension(xmlFileName, ".docx");


这篇关于如何从添加的Windows窗体中保存word文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆