Страница: 
		
		 
			   
			 
			 
			 
			 Страница: 
 
			
 
  
		
     
  
    
Вопрос: Замена текста в объекте Shape.TextFrame.TextRange
     
    
Добавлено: 08.11.11 14:59
     
      
  
				
			  
					 
			
				 
    
		
       
    
Автор вопроса:  
    
 OLGA | ICQ: 444555666 
      
       
  
Здравствуйте!
 
    
Помогите с заменой текста в объекте надпись Shape.TextFrame.TextRange.Text
Привожу пример кода:
                        For Each kolontitul In sec.Headers            'верхний колонтитул
                            For Each shp In kolontitul.Shapes
                                If shp.TextFrame.HasText = True Then
                                    Dim str As String = shp.TextFrame.TextRange.Text
                                    'Find text to replace
                                    If str.Contains(strWhat) Then
                                        'Replace exisitng text with the new text
                                        Dim idx As Integer = str.IndexOf(strWhat)
                                        Dim strStartText As String = str.Substring(0, idx)
                                        Dim strEndText As String = str.Substring(idx + strWhat.Length, str.Length - 1 - (idx + strWhat.Length - 1))
                                        shp.TextFrame.TextRange.Text = strStartText & strReplace & strEndText
                                        'If TypeOf shp Is TableLayoutPanel Then
                                        'Dim tfTbl As Microsoft.Office.Interop.Word.TextFrame
                                        'Dim tbl As Microsoft.Office.Interop.Word.Table
                                        'strNew
                                    End If
                                End If
                            Next shp
                        Next
Также не работает метод .Find.
Помогите кто сталкивался с этой проблемой. Я копаюсь уже неделю. Спасибо заранее.
				
		
		
					 
			
				 
  
		
     
  
    
Ответы
     
    
Всего ответов: 0