2012-08-28 35 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