com.aspose.words

Class HyphenationOptions

  • java.lang.Object
    • com.aspose.words.HyphenationOptions
  • All Implemented Interfaces:
    java.lang.Cloneable
    public class HyphenationOptions 
    extends java.lang.Object

Allows to configure document hyphenation options.

Example:

Shows how to configure automatic hyphenation.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.getFont().setSize(24.0);
builder.writeln("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
        "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");

doc.getHyphenationOptions().setAutoHyphenation(true);
doc.getHyphenationOptions().setConsecutiveHyphenLimit(2);
doc.getHyphenationOptions().setHyphenationZone(720);
doc.getHyphenationOptions().setHyphenateCaps(true);

doc.save(getArtifactsDir() + "Document.HyphenationOptions.docx");

Constructor Summary
 
Property Getters/Setters Summary
booleangetAutoHyphenation()
void
setAutoHyphenation(booleanvalue)
           Gets or sets value determining whether automatic hyphenation is turned on for the document. Default value for this property is false.
intgetConsecutiveHyphenLimit()
void
           Gets or sets the maximum number of consecutive lines that can end with hyphens. Default value for this property is 0.
booleangetHyphenateCaps()
void
setHyphenateCaps(booleanvalue)
           Gets or sets value determining whether words written in all capital letters are hyphenated. Default value for this property is true.
intgetHyphenationZone()
void
           Gets or sets the distance in 1/20 of a point from the right margin within which you do not want to hyphenate words. Default value for this property is 360 (0.25 inch).
 

    • Constructor Detail

      • HyphenationOptions

        public HyphenationOptions()
    • Property Getters/Setters Detail

      • getAutoHyphenation/setAutoHyphenation

        public boolean getAutoHyphenation() / public void setAutoHyphenation(boolean value)
        
        Gets or sets value determining whether automatic hyphenation is turned on for the document. Default value for this property is false.

        Example:

        Shows how to configure automatic hyphenation.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.getFont().setSize(24.0);
        builder.writeln("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
                "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
        
        doc.getHyphenationOptions().setAutoHyphenation(true);
        doc.getHyphenationOptions().setConsecutiveHyphenLimit(2);
        doc.getHyphenationOptions().setHyphenationZone(720);
        doc.getHyphenationOptions().setHyphenateCaps(true);
        
        doc.save(getArtifactsDir() + "Document.HyphenationOptions.docx");
      • getConsecutiveHyphenLimit/setConsecutiveHyphenLimit

        public int getConsecutiveHyphenLimit() / public void setConsecutiveHyphenLimit(int value)
        
        Gets or sets the maximum number of consecutive lines that can end with hyphens. Default value for this property is 0.

        If value of this property is set to 0, any number of consecutive lines can end with hyphens.

        The property does not have effect when saving to fixed page formats e.g. PDF.

        Example:

        Shows how to configure automatic hyphenation.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.getFont().setSize(24.0);
        builder.writeln("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
                "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
        
        doc.getHyphenationOptions().setAutoHyphenation(true);
        doc.getHyphenationOptions().setConsecutiveHyphenLimit(2);
        doc.getHyphenationOptions().setHyphenationZone(720);
        doc.getHyphenationOptions().setHyphenateCaps(true);
        
        doc.save(getArtifactsDir() + "Document.HyphenationOptions.docx");
      • getHyphenateCaps/setHyphenateCaps

        public boolean getHyphenateCaps() / public void setHyphenateCaps(boolean value)
        
        Gets or sets value determining whether words written in all capital letters are hyphenated. Default value for this property is true.

        Example:

        Shows how to configure automatic hyphenation.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.getFont().setSize(24.0);
        builder.writeln("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
                "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
        
        doc.getHyphenationOptions().setAutoHyphenation(true);
        doc.getHyphenationOptions().setConsecutiveHyphenLimit(2);
        doc.getHyphenationOptions().setHyphenationZone(720);
        doc.getHyphenationOptions().setHyphenateCaps(true);
        
        doc.save(getArtifactsDir() + "Document.HyphenationOptions.docx");
      • getHyphenationZone/setHyphenationZone

        public int getHyphenationZone() / public void setHyphenationZone(int value)
        
        Gets or sets the distance in 1/20 of a point from the right margin within which you do not want to hyphenate words. Default value for this property is 360 (0.25 inch).

        Example:

        Shows how to configure automatic hyphenation.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.getFont().setSize(24.0);
        builder.writeln("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
                "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
        
        doc.getHyphenationOptions().setAutoHyphenation(true);
        doc.getHyphenationOptions().setConsecutiveHyphenLimit(2);
        doc.getHyphenationOptions().setHyphenationZone(720);
        doc.getHyphenationOptions().setHyphenateCaps(true);
        
        doc.save(getArtifactsDir() + "Document.HyphenationOptions.docx");