在单词脚注中并排添加字段



嗨,我的单词应用程序有问题。我正在尝试在脚注中并排添加一个字段。我遇到的问题是合并冲突,我认为这是因为范围相同并且过度扭动另一个字段。我正在尝试根据上一个字段的终点将它们并排放在一行中。

我尝试将范围折叠到最后,但我无法让它工作。任何帮助将不胜感激,因为我不喜欢使用 VSTO 工具和 tbh,我发现它们不是很好。

   public static void insertHtmlIntoFootnoteResult (Field field, List<ct> 
        list)
       {     
      for(var c in ct){
           //I am trying to go to the end here
        field.Result.Collapse(WdCollapseDirection.wdCollapseEnd); 
        //How do I create a new field and insert it here based of the the 
        //last fields ending position?
        string guid = Guid.NewGuid().ToString();
        var filename = Path.GetTempPath() + "temp" + guid + ".html";
        using (StreamWriter s = File.CreateText(filename))
        {
            s.Write("I am test");
            s.Close();
        }                 
        field.Result.InsertFile(filename);
        File.Delete(filename);
       }
    } // _insertHtmlIntoRange
嘿,

所以我最终使用鲜花的博客文章找到了答案

https://gist.github.com/FlorianWolters/6257233

通过更改 insertempty(( 方法插入 Word.WdFieldType.wdFieldIf 字段来完成。

希望这对未来的人们有所帮助!

最新更新