Styles

This document is about how to set up and use style objects.

Table of contents

Cell Styles

Set up a CellStyle object and add it to the Content object like that:

<?php

use IDML\Content\Style\CellStyle;

$myCellStyle = new CellStyle();

$content->addCellStyle($myCellStyle);

If you want to set your own unique identifier — which is recommended here —, set up the CellStyle like that: new CellStyle('UniqueName');

A cell style object can be used in other elements, for example:

<?php 

$myTableStyle->setBodyRegionCellStyle($myCellStyle);

Character Styles

Set up a CharacterStyle object and add it to the Content object like that:

<?php

use IDML\Content\Style\CharacterStyle;

$myCharacterStyle = new CharacterStyle();

$content->addCharacterStyle($myCharacterStyle);

If you want to set your own unique identifier — which is recommended here —, set up the CharacterStyle like that: new CharacterStyle('UniqueName');

A character style object can be used in other elements, for example:

<?php 

$myCharacterStyle->setNextStyle($myFollowingCharacterStyle);

Object Styles

Set up an ObjectStyle object and add it to the Content object like that:

<?php

use IDML\Content\Style\ObjectStyle;

$myCharacterStyle = new ObjectStyle();

$content->addObjectStyle($myCharacterStyle);

If you want to set your own unique identifier — which is recommended here —, set up the ObjectStyle like that: new ObjectStyle('UniqueName');

A object style object can be used in other elements, for example:

<?php 

$myTextFrame->setAppliedObjectStyle($myObjectStyle);

Paragraph Styles

Set up a ParagraphStyle object and add it to the Content object like that:

<?php

use IDML\Content\Style\ParagraphStyle;

$myParagraphStyle = new ParagraphStyle();

$content->addParagraphStyle($myParagraphStyle);

If you want to set your own unique identifier — which is recommended here —, set up the ParagraphStyle like that: new ParagraphStyle('UniqueName');

A paragraph style object can be used in other elements, for example:

<?php 

$myParagraphStyle->setNextStyle($myFollowingParagraphStyle);

Table Styles

Set up a TableStyle object and add it to the Content object like that:

<?php

use IDML\Content\Style\TableStyle;

$myTableStyle = new TableStyle('myTableStyle');

$content->addTableStyle($myTableStyle);

If you want to set your own unique identifier — which is recommended here —, set up the TableStyle like that: new TableStyle('UniqueName');