com.aspose.words
Class HyphenationOptions

java.lang.Object
    extended by 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 document hyphenation options.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Set this to insert a page break before this paragraph
builder.getFont().setSize(24.0);
builder.getParagraphFormat().setSuppressAutoHyphens(false);

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); // 0.5 inch
doc.getHyphenationOptions().setHyphenateCaps(true);

// Each paragraph has this flag that can be set to suppress hyphenation
Assert.assertFalse(builder.getParagraphFormat().getSuppressAutoHyphens());

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

Constructor Summary
HyphenationOptions()
          
 
Property Getters/Setters Summary
booleangetAutoHyphenation()
voidsetAutoHyphenation(boolean value)
           Gets or sets value determining whether automatic hyphenation is turned on for the document. Default value for this property is false.
intgetConsecutiveHyphenLimit()
voidsetConsecutiveHyphenLimit(int value)
           Gets or sets the maximum number of consecutive lines that can end with hyphens. Default value for this property is 0.
booleangetHyphenateCaps()
voidsetHyphenateCaps(boolean value)
           Gets or sets value determining whether words written in all capital letters are hyphenated. Default value for this property is true.
intgetHyphenationZone()
voidsetHyphenationZone(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).
 

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();
DocumentBuilder builder = new DocumentBuilder(doc);

// Set this to insert a page break before this paragraph
builder.getFont().setSize(24.0);
builder.getParagraphFormat().setSuppressAutoHyphens(false);

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); // 0.5 inch
doc.getHyphenationOptions().setHyphenateCaps(true);

// Each paragraph has this flag that can be set to suppress hyphenation
Assert.assertFalse(builder.getParagraphFormat().getSuppressAutoHyphens());

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 document hyphenation options.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Set this to insert a page break before this paragraph
builder.getFont().setSize(24.0);
builder.getParagraphFormat().setSuppressAutoHyphens(false);

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); // 0.5 inch
doc.getHyphenationOptions().setHyphenateCaps(true);

// Each paragraph has this flag that can be set to suppress hyphenation
Assert.assertFalse(builder.getParagraphFormat().getSuppressAutoHyphens());

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 document hyphenation options.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Set this to insert a page break before this paragraph
builder.getFont().setSize(24.0);
builder.getParagraphFormat().setSuppressAutoHyphens(false);

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); // 0.5 inch
doc.getHyphenationOptions().setHyphenateCaps(true);

// Each paragraph has this flag that can be set to suppress hyphenation
Assert.assertFalse(builder.getParagraphFormat().getSuppressAutoHyphens());

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 document hyphenation options.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Set this to insert a page break before this paragraph
builder.getFont().setSize(24.0);
builder.getParagraphFormat().setSuppressAutoHyphens(false);

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); // 0.5 inch
doc.getHyphenationOptions().setHyphenateCaps(true);

// Each paragraph has this flag that can be set to suppress hyphenation
Assert.assertFalse(builder.getParagraphFormat().getSuppressAutoHyphens());

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

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.