GetIndexByPosition
Inhalt
[
Ausblenden
]TabStopCollection.GetIndexByPosition method
Ruft den Index eines Tabulators mit der angegebenen Position in Punkten ab.
public int GetIndexByPosition(double position)
Beispiele
Zeigt, wie Sie eine Position nachschlagen, um festzustellen, ob dort ein Tabulator vorhanden ist, und wie Sie dessen Index abrufen.
Document doc = new Document();
TabStopCollection tabStops = doc.FirstSection.Body.Paragraphs[0].ParagraphFormat.TabStops;
// Fügen Sie an einer Position von 30 mm einen Tabulator hinzu.
tabStops.Add(ConvertUtil.MillimeterToPoint(30), TabAlignment.Left, TabLeader.Dashes);
// Ein von "GetIndexByPosition" zurückgegebenes Ergebnis von "0" bestätigt, dass ein Tabstopp
// bei 30 mm ist in dieser Sammlung vorhanden und befindet sich am Index 0.
Assert.AreEqual(0, tabStops.GetIndexByPosition(ConvertUtil.MillimeterToPoint(30)));
// Eine von "GetIndexByPosition" zurückgegebene "-1" bestätigt, dass
// In dieser Sammlung gibt es keinen Tabstopp mit einer Position von 60 mm.
Assert.AreEqual(-1, tabStops.GetIndexByPosition(ConvertUtil.MillimeterToPoint(60)));
Siehe auch
- class TabStopCollection
- namensraum Aspose.Words
- Montage Aspose.Words