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.

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 document hyphenation options.
        Document doc = new Document();
        // Create new Run with text that we want to move to the next line using the hyphen
        Run run = new Run(doc);
        {
            run.setText("poqwjopiqewhpefobiewfbiowefob ewpj weiweohiewobew ipo efoiewfihpewfpojpief pijewfoihewfihoewfphiewfpioihewfoihweoihewfpj");
        }
        
        Paragraph para = doc.getFirstSection().getBody().getParagraphs().get(0);
        para.appendChild(run);
        
        doc.getHyphenationOptions().setAutoHyphenation(true);
        doc.getHyphenationOptions().setConsecutiveHyphenLimit(2);
        doc.getHyphenationOptions().setHyphenationZone(720); // 0.5 inch
        doc.getHyphenationOptions().setHyphenateCaps(true);
        
        doc.save(getMyDir() + "\\Artifacts\\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 document hyphenation options.
        Document doc = new Document();
        // Create new Run with text that we want to move to the next line using the hyphen
        Run run = new Run(doc);
        {
            run.setText("poqwjopiqewhpefobiewfbiowefob ewpj weiweohiewobew ipo efoiewfihpewfpojpief pijewfoihewfihoewfphiewfpioihewfoihweoihewfpj");
        }
        
        Paragraph para = doc.getFirstSection().getBody().getParagraphs().get(0);
        para.appendChild(run);
        
        doc.getHyphenationOptions().setAutoHyphenation(true);
        doc.getHyphenationOptions().setConsecutiveHyphenLimit(2);
        doc.getHyphenationOptions().setHyphenationZone(720); // 0.5 inch
        doc.getHyphenationOptions().setHyphenateCaps(true);
        
        doc.save(getMyDir() + "\\Artifacts\\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 document hyphenation options.
        Document doc = new Document();
        // Create new Run with text that we want to move to the next line using the hyphen
        Run run = new Run(doc);
        {
            run.setText("poqwjopiqewhpefobiewfbiowefob ewpj weiweohiewobew ipo efoiewfihpewfpojpief pijewfoihewfihoewfphiewfpioihewfoihweoihewfpj");
        }
        
        Paragraph para = doc.getFirstSection().getBody().getParagraphs().get(0);
        para.appendChild(run);
        
        doc.getHyphenationOptions().setAutoHyphenation(true);
        doc.getHyphenationOptions().setConsecutiveHyphenLimit(2);
        doc.getHyphenationOptions().setHyphenationZone(720); // 0.5 inch
        doc.getHyphenationOptions().setHyphenateCaps(true);
        
        doc.save(getMyDir() + "\\Artifacts\\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 document hyphenation options.
        Document doc = new Document();
        // Create new Run with text that we want to move to the next line using the hyphen
        Run run = new Run(doc);
        {
            run.setText("poqwjopiqewhpefobiewfbiowefob ewpj weiweohiewobew ipo efoiewfihpewfpojpief pijewfoihewfihoewfphiewfpioihewfoihweoihewfpj");
        }
        
        Paragraph para = doc.getFirstSection().getBody().getParagraphs().get(0);
        para.appendChild(run);
        
        doc.getHyphenationOptions().setAutoHyphenation(true);
        doc.getHyphenationOptions().setConsecutiveHyphenLimit(2);
        doc.getHyphenationOptions().setHyphenationZone(720); // 0.5 inch
        doc.getHyphenationOptions().setHyphenateCaps(true);
        
        doc.save(getMyDir() + "\\Artifacts\\HyphenationOptions.docx");