详细步骤:
第 1 步:初始化 Document 对象并加载 Word 文档
Document document = new Document();document.LoadFromFile("Input.docm");
第 2 步:如果文档包含宏,请将它们从文档中删除。
if (document.IsContainMacro){document.ClearMacros();}
第 3 步:保存文档。
document.SaveToFile("Output.docm", FileFormat.Docm);
完整代码:
using Spire.Doc;namespace Remove_Macros_from_Word{class Program{static void Main(string[] args){//Initialize a Document objectDocument document = new Document();//Load the Word documentdocument.LoadFromFile("Input.docm");//If the document contains macros, remove them from the documentif (document.IsContainMacro){document.ClearMacros();}//Save the documentdocument.SaveToFile("Output.docm", FileFormat.Docm);}}}
欢迎下载|体验更多E-iceblue产品
如需获取更多产品相关信息请咨询在线客服

标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!