2017-07-10 11 views

答えて

0

個人的に私は、テキストなど、いくつかのタグを定義いくつかのタイトルのテンプレート文書を使用しています:

  1. を[TITLE 1]

その後、私はこのようなものを使用しています:

using (document = DocX.Load(TEMPLATE_LOCATION)) 
{ 
    #region Static data 

    //Get datas from the ressource files and translate tag 
    ResourceSet resourceSet = StaticLabels.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true); 
    foreach (DictionaryEntry entry in resourceSet) 
    { 

     string resourceKey = entry.Key.ToString(); 
     string resource = (string)entry.Value; 
     document.ReplaceText(resourceKey, resource); 
    } 

    #endregion //Static Data 

    #region Add Table of content 

    document.InsertDefaultTableOfContents(); 

    #endregion //Table of content 

} 

ressourceファイルには[タイトル1]とそれを置き換えるいくつかのテックスが含まれています

また、次のものを使用することもできます。

document.ReplaceText("[TITLE]", "My Title"); 
関連する問題