java.lang.Object
com.aspose.words.FontInfoCollection
- All Implemented Interfaces:
- java.lang.Iterable
public class FontInfoCollection
- extends java.lang.Object
Represents a collection of fonts used in a document.
Items are FontInfo objects.
You do not create instances of this class directly.
Use the DocumentBase.FontInfos property to access the collection of fonts
defined in the document.
Example:
Shows how to gather the details of what fonts are present in a document.
Document doc = new Document(getMyDir() + "Document.doc");
FontInfoCollection fonts = doc.getFontInfos();
int fontIndex = 1;
// The fonts info extracted from this document does not necessarily mean that the fonts themselves are
// used in the document. If a font is present but not used then most likely they were referenced at some time
// and then removed from the Document.
for (FontInfo info : fonts)
{
// Print out some important details about the font.
System.out.println(MessageFormat.format("Font #{0}", fontIndex));
System.out.println(MessageFormat.format("Name: {0}", info.getName()));
System.out.println(MessageFormat.format("IsTrueType: {0}", info.isTrueType()));
fontIndex++;
}
- See Also:
- FontInfo, DocumentBase.FontInfos
Property Getters/Setters Summary |
int | getCount() | |
|
Gets the number of elements contained in the collection.
|
FontInfo | get(int index) | |
|
Gets a font at the specified index.
|
FontInfo | get(java.lang.String name) | |
|
Gets a font with the specified name.
|
Method Summary |
boolean | contains(java.lang.String name) | |
Determines whether the collection contains a font with the given name.
|
java.util.Iterator | iterator() | |
Returns an iterator object that can be used to iterate over all items in the collection.
|
Property Getters/Setters Detail |
getCount | |
public int getCount()
|
-
Gets the number of elements contained in the collection.
-
Gets a font at the specified index.
- Parameters:
index
- Zero-based index of the font.
get | |
public FontInfo get(java.lang.String name)
|
-
Gets a font with the specified name.
- Parameters:
name
- Case-insensitive name of the font to locate.
contains | |
public boolean contains(java.lang.String name) |
-
Determines whether the collection contains a font with the given name.
- Parameters:
name
- Case-insensitive name of the font to locate.
- Returns:
- True if the item is found in the collection; otherwise, false.
iterator | |
public java.util.Iterator iterator() |
-
Returns an iterator object that can be used to iterate over all items in the collection.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.