PortionFormat

Inheritance: java.lang.Object, com.aspose.slides.PVIObject, com.aspose.slides.BasePortionFormat

All Implemented Interfaces: com.aspose.slides.IPortionFormat

public final class PortionFormat extends BasePortionFormat implements IPortionFormat

This class contains the text portion formatting properties. Unlike IPortionFormatEffectiveData, all properties of this class are writeable.


The following examples shows you how to assign the Latin font to a Paragraph's portion of PowerPoint Presentation.
 
 //Instantiate a presentation object that represents a presentation file
 Presentation pres = new Presentation("demo.pptx");
 try {
     IAutoShape shape = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 10, 10, 100, 100);
     Paragraph paragraph = new Paragraph();
     Portion portion = new Portion("Theme text format");
     paragraph.getPortions().add(portion);
     shape.getTextFrame().getParagraphs().add(paragraph);
     // Aspose.Slides uses these special identifiers (similar to those used in PowerPoint):
     // +mn-lt - Body Font Latin (Minor Latin Font)
     // +mj-lt -Heading Font Latin (Major Latin Font)
     // +mn-ea - Body Font East Asian (Minor East Asian Font)
     // +mj-ea - Body Font East Asian (Minor East Asian Font)
     portion.getPortionFormat().setLatinFont(new FontData("+mn-lt"));
 } finally {
     if (pres != null) pres.dispose();
 }

This class is used to return and manipulate text portion formatting properties defined for the particular portion. This means that no inheritance is applied when getting values so for the majority of cases you will get values meaning “undefined”.

In order to get the effective formatting parameter values including inherited you need to use getEffective method which returns a IPortionFormatEffectiveData instance.

Constructors

ConstructorDescription
PortionFormat()Initializes a new instance of PortionFormat class.

Methods

MethodDescription
getBookmarkId()Returns or sets bookmark identifier.
setBookmarkId(String value)Returns or sets bookmark identifier.
getSmartTagClean()Determines whether the smart tag should be cleaned.
setSmartTagClean(boolean value)Determines whether the smart tag should be cleaned.
getHyperlinkClick()Returns or sets the hyperlink defined for mouse click.
setHyperlinkClick(IHyperlink value)Returns or sets the hyperlink defined for mouse click.
getHyperlinkMouseOver()Returns or sets the hyperlink defined for mouse over.
setHyperlinkMouseOver(IHyperlink value)Returns or sets the hyperlink defined for mouse over.
getHyperlinkManager()Hyperlinks manager.
getEffective()Gets effective portion formatting data with the inheritance applied.

PortionFormat()

public PortionFormat()

Initializes a new instance of PortionFormat class.

getBookmarkId()

public final String getBookmarkId()

Returns or sets bookmark identifier. Read/write String.

Returns: java.lang.String

setBookmarkId(String value)

public final void setBookmarkId(String value)

Returns or sets bookmark identifier. Read/write String.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getSmartTagClean()

public final boolean getSmartTagClean()

Determines whether the smart tag should be cleaned. No inheritance applied. Read/write boolean .

Returns: boolean

setSmartTagClean(boolean value)

public final void setSmartTagClean(boolean value)

Determines whether the smart tag should be cleaned. No inheritance applied. Read/write boolean .

Parameters:

ParameterTypeDescription
valueboolean

getHyperlinkClick()

public final IHyperlink getHyperlinkClick()

Returns or sets the hyperlink defined for mouse click. Read/write IHyperlink.

Returns: IHyperlink

public final void setHyperlinkClick(IHyperlink value)

Returns or sets the hyperlink defined for mouse click. Read/write IHyperlink.

Parameters:

ParameterTypeDescription
valueIHyperlink

getHyperlinkMouseOver()

public final IHyperlink getHyperlinkMouseOver()

Returns or sets the hyperlink defined for mouse over. Read/write IHyperlink.

Returns: IHyperlink

public final void setHyperlinkMouseOver(IHyperlink value)

Returns or sets the hyperlink defined for mouse over. Read/write IHyperlink.

Parameters:

ParameterTypeDescription
valueIHyperlink

getHyperlinkManager()

public final IHyperlinkManager getHyperlinkManager()

Hyperlinks manager. Read-only IHyperlinkManager.

Returns: IHyperlinkManager

getEffective()

public final IPortionFormatEffectiveData getEffective()

Gets effective portion formatting data with the inheritance applied.


This example demonstrates getting some effective portion format properties.
 
 Presentation pres = new Presentation("MyPresentation.pptx");
 try
 {
 	IAutoShape shape = (IAutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(0);
 	IPortionFormatEffectiveData effectivePortionFormat = shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getEffective();
 	System.out.println("Latin font: " + effectivePortionFormat.getLatinFont().getFontName());
 	System.out.println("Font height: " + effectivePortionFormat.getFontHeight());
 	System.out.println("Fill type: " + effectivePortionFormat.getFillFormat().getFillType());
 } finally {
  if (pres != null) pres.dispose();
 }

Returns: IPortionFormatEffectiveData - A IPortionFormatEffectiveData.