Proprietà Bookmark.FormattedText
Ottiene o imposta un oggetto Range che include il testo formattato nel controllo Bookmark.
Spazio dei nomi: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
Sintassi
'Dichiarazione
Property FormattedText As Range
Get
Set
Range FormattedText { get; set; }
Valore proprietà
Tipo: Microsoft.Office.Interop.Word.Range
Oggetto Range che include il testo formattato nel controllo Bookmark.
Note
Quando si imposta questa proprietà, il testo presente nel controllo Bookmark viene sostituito con testo formattato.
Esempi
Nell'esempio di codice seguente viene inserito testo nel primo paragrafo e viene formattata in grassetto la terza parola. La terza parola viene quindi copiata, con la relativa formattazione, in un controllo Bookmark.
Questo esempio è valido per una personalizzazione a livello di documento.
Private Sub BookmarkFormattedText()
Me.Paragraphs(1).Range.InsertParagraphBefore()
Me.Paragraphs(1).Range.InsertParagraphBefore()
Me.Paragraphs(1).Range.Text = "This is text in the " & "first paragraph."
Me.Paragraphs(1).Range.Words(3).Bold = True
Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
Me.Controls.AddBookmark(Me.Paragraphs(2).Range, "Bookmark1")
Bookmark1.FormattedText = Me.Paragraphs(1).Range.Words(3)
End Sub
private void BookmarkFormattedText()
{
int WordTrue = 1;
this.Paragraphs[1].Range.InsertParagraphBefore();
this.Paragraphs[1].Range.InsertParagraphBefore();
this.Paragraphs[1].Range.Text = "This is text in the "
+ "first paragraph.";
this.Paragraphs[1].Range.Words[3].Bold = WordTrue;
Microsoft.Office.Tools.Word.Bookmark bookmark1 =
this.Controls.AddBookmark(this.Paragraphs[2].Range,
"bookmark1");
bookmark1.FormattedText = this.Paragraphs[1].Range.Words[3];
}
Sicurezza di .NET Framework
- Attendibilità totale per il chiamante immediato. Impossibile utilizzare questo membro in codice parzialmente attendibile. Per ulteriori informazioni, vedere Utilizzo di librerie da codice parzialmente attendibile.