|
java.lang.Object
com.aspose.words.StyleIdentifier
public class StyleIdentifier - extends java.lang.Object
Utility class containing constants.
Locale independent style identifier.
The names of built-in styles in MS Word are localized for different languages.
Using a style identifier you can find the correct style regardless of the document language. All user defined styles are assigned the StyleIdentifier.User value. Example: Shows how to use style identifier to find text formatted with a specific character style and apply different character style.
Document doc = new Document(getMyDir() + "Font.StyleIdentifier.doc");
// Select all run nodes in the document.
NodeCollection<Run> runs = doc.getChildNodes(NodeType.RUN, true);
// Loop through every run node.
for (Run run : runs)
{
// If the character style of the run is what we want, do what we need. Change the style in this case.
// Note that using StyleIdentifier we can identify a built-in style regardless
// of the language of Microsoft Word used to create the document.
if (run.getFont().getStyleIdentifier() == StyleIdentifier.EMPHASIS)
run.getFont().setStyleIdentifier(StyleIdentifier.STRONG);
}
doc.save(getMyDir() + "Font.StyleIdentifier Out.doc");
|