2012-08-28 36 views

回答

1

找到了解决方案。我在我的问题中提供的链接包含“在单个文档中使用绝对超链接”部分,其中说明如果将“x”放置在超链接基本字段中,则此文档将使用绝对文件引用。要获得的财产在C#:

foreach (DocumentProperty prop in (DocumentProperties)Doc.BuiltInDocumentProperties) 
{ 
    if (prop.Name == "Hyperlink base") 
    { 
     prop.Value = "x"; 
     break; 
    } 
} 
0

我有相反的问题,我想保持相对链接在保存所以从史蒂芬布鲁斯的回答对我没有帮助。 这对我有用。

using Microsoft.Office.Interop.Word; 

// Create a word app 
Microsoft.Office.Interop.Word.Application winword = new Microsoft.Office.Interop.Word.Application(); 
// Change setting so that hyperlinks do not update on save 
DefaultWebOptions WordOptions = winword.DefaultWebOptions(); 
WordOptions.UpdateLinksOnSave = false; // or true in your case