zoukankan      html  css  js  c++  java
  • c# word 在当前光标位置插入内容

    /// <summary>
            /// 在当前光标位置插入内容
            /// </summary>
            /// <param name="text">内容</param>
            public void SelectionInsertText(string text)
            {
                Word.Selection currentSelection = Application.Selection;

                // Store the user's current Overtype selection
                bool userOvertype = Application.Options.Overtype;

                // Make sure Overtype is turned off.
                if (Application.Options.Overtype)
                {
                    Application.Options.Overtype = false;
                }

                // Test to see if selection is an insertion point.
                if (currentSelection.Type == Word.WdSelectionType.wdSelectionIP)
                {
                    //currentSelection.TypeText("Inserting at insertion point. ");
                    currentSelection.TypeText(text);
                    currentSelection.TypeParagraph();
                }
                else
                {
                    if (currentSelection.Type == Word.WdSelectionType.wdSelectionNormal)
                    {
                        // Move to start of selection.
                        if (Application.Options.ReplaceSelection)
                        {
                            object direction = Word.WdCollapseDirection.wdCollapseStart;
                            currentSelection.Collapse(ref direction);
                        }
                        //currentSelection.TypeText("Inserting before a text block. ");
                        currentSelection.TypeText(text);
                        currentSelection.TypeParagraph();
                    }
                    else
                    {
                        // Do nothing.
                    }
                }

                // Restore the user's Overtype selection
                Application.Options.Overtype = userOvertype;
            }

  • 相关阅读:
    JAVA 实现json diff
    Apache httpclient拦截器对请求进行签名
    okHttp3教程:5种基本请求示例,拦截器实现自动重试和日志打印
    代码执行testng的几种方式
    封装log4j支持记录到testng
    修改ZuulHandlerMapping私有变量pathMatcher,重写match方法,使url匹配兼容正则表达式。
    修改testng源码,添加beforeMethod和afterMethod中的日志到test中(可以不改源码,废弃)
    Linux Python import jenkins 报错 oserror: /usr/lib/python2.7/site-packages/lookup3.so
    mongodb相关查询
    monkey命令参数介绍
  • 原文地址:https://www.cnblogs.com/xsmhero/p/1436892.html
Copyright © 2011-2022 走看看