java.lang.Object
com.aspose.words.StructuredDocumentTagCollection
public class StructuredDocumentTagCollection
To learn more, visit the Structured Document Tags or Content Control documentation article.
| Property Getters/Setters Summary | ||
|---|---|---|
int | getCount() | |
| Returns the number of structured document tags in the collection. | ||
IStructuredDocumentTag | get(int index) | |
| Returns the structured document tag at the specified index. | ||
| Method Summary | ||
|---|---|---|
IStructuredDocumentTag | getById(int id) | |
| Returns the structured document tag by identifier. | ||
IStructuredDocumentTag | getByTag(java.lang.String tag) | |
| Returns the first structured document tag encountered in the collection with the specified tag. | ||
IStructuredDocumentTag | getByTitle(java.lang.String title) | |
| Returns the first structured document tag encountered in the collection with the specified title. | ||
java.util.Iterator<IStructuredDocumentTag> | iterator() | |
| Returns an enumerator object. | ||
void | remove(int id) | |
| Removes the structured document tag with the specified identifier. | ||
void | removeAt(int index) | |
| Removes a structured document tag at the specified index. | ||
| Property Getters/Setters Detail |
|---|
getCount | |
public int getCount() | |
get | |
public IStructuredDocumentTag get(int index) | |
index - An index into the collection.| Method Detail |
|---|
getById | |
public IStructuredDocumentTag getById(int id) | |
Returns null if the structured document tag with the specified identifier cannot be found.
id - The structured document tag identifier.Example:
Shows how to get structured document tag.
Document doc = new Document(getMyDir() + "Structured document tags by id.docx");
// Get the structured document tag by Id.
IStructuredDocumentTag sdt = doc.getRange().getStructuredDocumentTags().getById(1160505028);
System.out.println(sdt.isRanged());
System.out.println(sdt.getTitle());
// Get the structured document tag or ranged tag by Title.
sdt = doc.getRange().getStructuredDocumentTags().getByTitle("Alias4");
System.out.println(sdt.getId());getByTag | |
public IStructuredDocumentTag getByTag(java.lang.String tag) | |
Returns null if the structured document tag with the specified tag cannot be found.
tag - The tag of the structured document tag.getByTitle | |
public IStructuredDocumentTag getByTitle(java.lang.String title) | |
Returns null if the structured document tag with the specified title cannot be found.
title - The title of structured document tag.Example:
Shows how to get structured document tag.
Document doc = new Document(getMyDir() + "Structured document tags by id.docx");
// Get the structured document tag by Id.
IStructuredDocumentTag sdt = doc.getRange().getStructuredDocumentTags().getById(1160505028);
System.out.println(sdt.isRanged());
System.out.println(sdt.getTitle());
// Get the structured document tag or ranged tag by Title.
sdt = doc.getRange().getStructuredDocumentTags().getByTitle("Alias4");
System.out.println(sdt.getId());iterator | |
public java.util.Iterator<IStructuredDocumentTag> iterator() | |
remove | |
public void remove(int id) | |
id - The structured document tag identifier.Example:
Shows how to remove structured document tag.
Document doc = new Document(getMyDir() + "Structured document tags.docx");
StructuredDocumentTagCollection structuredDocumentTags = doc.getRange().getStructuredDocumentTags();
IStructuredDocumentTag sdt;
for (int i = 0; i < structuredDocumentTags.getCount(); i++)
{
sdt = structuredDocumentTags.get(i);
System.out.println(sdt.getTitle());
}
sdt = structuredDocumentTags.getById(1691867797);
Assert.assertEquals(1691867797, sdt.getId());
Assert.assertEquals(5, structuredDocumentTags.getCount());
// Remove the structured document tag by Id.
structuredDocumentTags.remove(1691867797);
// Remove the structured document tag at position 0.
structuredDocumentTags.removeAt(0);
Assert.assertEquals(3, structuredDocumentTags.getCount());removeAt | |
public void removeAt(int index) | |
index - An index into the collection.Example:
Shows how to remove structured document tag.
Document doc = new Document(getMyDir() + "Structured document tags.docx");
StructuredDocumentTagCollection structuredDocumentTags = doc.getRange().getStructuredDocumentTags();
IStructuredDocumentTag sdt;
for (int i = 0; i < structuredDocumentTags.getCount(); i++)
{
sdt = structuredDocumentTags.get(i);
System.out.println(sdt.getTitle());
}
sdt = structuredDocumentTags.getById(1691867797);
Assert.assertEquals(1691867797, sdt.getId());
Assert.assertEquals(5, structuredDocumentTags.getCount());
// Remove the structured document tag by Id.
structuredDocumentTags.remove(1691867797);
// Remove the structured document tag at position 0.
structuredDocumentTags.removeAt(0);
Assert.assertEquals(3, structuredDocumentTags.getCount());