删除单词c#中的链接对象 [英] Remove linked objects in word c#

查看:89
本文介绍了删除单词c#中的链接对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个C#应用程序,它将几个word文档合并为一个,将其保存在文件系统中,并在嵌入C#应用程序的word文件中打开它。这些源文档可能包含指向外部对象(如图像或文件)的链接。当将文件
合并为一个时,我想通过C#以编程方式删除这些链接。我怎样才能做到这一点?我正在使用Microsoft.Office.Interop.Word库。

I have a C# application which merges several word documents into one, save it in the file system and open it in a word file embedded in a C# application. these source documents may contain links to external objects like images or files. when merging the documents into one, i want to remove these links programmatically by C#. how can i do this? i am using Microsoft.Office.Interop.Word library.


以下是我合并文档的逻辑。

below is my logic for merging documents.

public void MergeDocuments( List<String> fileList )
    {
        object nullobj = System.Reflection.Missing.Value;
        object falseObj = false;            
        LoadWord();

        object sectionBreak = Word.WdBreakType.wdSectionBreakNextPage;
        document = wd.Documents.Add(ref nullobj, ref nullobj, ref nullobj, ref nullobj);
        document.PageSetup.PaperSize = Word.WdPaperSize.wdPaperA4;
        Word.Selection selection = wd.Selection;

        foreach (String filePath in fileList)
        {
            selection.InsertFile(filePath, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
            selection.InsertBreak(ref sectionBreak);
        }
        //set the settings for the word window
        SetWordWindow();
    }



感谢您的紧急支持

appreciate your urgent support

推荐答案

检查这篇文章是否有帮助: 

Check if this article helps: 


这篇关于删除单词c#中的链接对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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