FontData — Aspose.Slides FOSS for Java API Reference
In Aspose.Slides FOSS for Java, font properties are managed through IPortionFormat (returned by Portion.getPortionFormat()), which extends IBasePortionFormat. The BasePortionFormat class provides access to font name, size, bold, italic, underline, and other character-level formatting.
Package: org.aspose.slides.foss
import org.aspose.slides.foss.*;BasePortionFormat (IBasePortionFormat)
The BasePortionFormat class is the base for PortionFormat and provides character-level formatting properties.
public class BasePortionFormat implements IBasePortionFormatKey Properties
| Property | Type | Access | Description |
|---|---|---|---|
getLineFormat() | ILineFormat | Read | Text outline formatting. |
getFillFormat() | IFillFormat | Read | Text fill formatting. |
getEffectFormat() | IEffectFormat | Read | Text effect formatting. |
getFontHeight() / setFontHeight(double) | double | Read/Write | Font size in points. |
getFontBold() / setFontBold(NullableBool) | NullableBool | Read/Write | Bold flag. |
getFontItalic() / setFontItalic(NullableBool) | NullableBool | Read/Write | Italic flag. |
getFontUnderline() / setFontUnderline(TextUnderlineType) | TextUnderlineType | Read/Write | Underline style. |
PortionFormat (IPortionFormat)
PortionFormat extends BasePortionFormat for portion-level formatting.
public class PortionFormat extends BasePortionFormat implements IPortionFormatUsage Examples
Set Font Properties
import org.aspose.slides.foss.*;
Presentation prs = new Presentation();
IAutoShape shape = prs.getSlides().get(0).getShapes()
.addAutoShape(ShapeType.RECTANGLE, 50, 50, 300, 100);
shape.addTextFrame("Styled text");
IPortion portion = shape.getTextFrame().getParagraphs().get(0).getPortions().get(0);
IPortionFormat fmt = portion.getPortionFormat();
fmt.setFontHeight(24);
fmt.setFontBold(NullableBool.TRUE);
prs.save("font.pptx", SaveFormat.PPTX);