Задать вопрос
Ответы пользователя по тегу C#
  • Как в C# обрабатывать все необработанные исключения?

    Iliapan
    @Iliapan
    обращения к ним в try...catch блок
    Ответ написан
    Комментировать
  • Закладки Word

    Iliapan
    @Iliapan
    вообще обленились?

        To insert text in a range
    
    1. Specify a range at the beginning of a document and insert the text New Text.
    
    The following code example can be used in a document-level customization.
    
    object start = 0;
    
    object end = 0;
    
    Word.Range rng = this.Range(ref start, ref end);
    
    rng.Text = “New Text”;
    
    The following code example can be used in an application-level add-in. This code uses the active document.
    
    Word.Range rng = this.Application.ActiveDocument.Range(0, 0);
    
    rng.Text = “New Text”;
    
    2. Select the Range object, which has expanded from one character to the length of the inserted text.
    
    rng.Select();
    
        Replacing Text in a Range
    
    If the specified range contains text, all text in the range is replaced with the inserted text.
    
     1. Create a Range object that consists of the first 12 characters in the document.
    
    The following code example can be used in a document-level customization.
    
    object start = 0;
    
    object end = 12;
    
    Word.Range rng = this.Range(ref start, ref end);
    
    The following code example can be used in an application-level add-in. This code uses the active document.
    
    Word.Range rng = this.Application.ActiveDocument.Range(0, 12);
    
    2. Replace those characters with the string New Text.
    
    rng.Text = “New Text”;
    
    3. Select the range.
    
    rng.Select();
    
    Ответ написан
    5 комментариев