Proprietà Bookmark.StoryLength
Ottiene il numero di caratteri nel brano contenente il controllo Bookmark.
Spazio dei nomi: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
Sintassi
'Dichiarazione
ReadOnly Property StoryLength As Integer
Get
int StoryLength { get; }
Valore proprietà
Tipo: System.Int32
Numero di caratteri nel brano contenente il controllo Bookmark.
Esempi
Nell'esempio di codice seguente viene aggiunto un controllo Bookmark con testo al documento e, se la lunghezza del brano è maggiore di 0, in una finestra di messaggio verrà visualizzato il testo del segnalibro.
Questo esempio è valido per una personalizzazione a livello di documento.
Private Sub BookmarkStoryLength()
Me.Paragraphs(1).Range.InsertParagraphBefore()
Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
Bookmark1.Text = "This is sample bookmark text."
If bookmark1.StoryLength > 1 Then
MessageBox.Show(Bookmark1.Text)
End If
End Sub
private void BookmarkStoryLength()
{
this.Paragraphs[1].Range.InsertParagraphBefore();
Microsoft.Office.Tools.Word.Bookmark bookmark1 =
this.Controls.AddBookmark(this.Paragraphs[1].Range,
"bookmark1");
bookmark1.Text = "This is sample bookmark text.";
if (bookmark1.StoryLength > 1)
{
MessageBox.Show(bookmark1.Text);
}
}
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.