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;

$cellStyle = new CellStyle();

$content->add($cellStyle);

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

Since IDML-Creator version 4.0, you can use the Factory to create and register the CellStyle:

$cellStyle = $factory->createCellStyle();

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

<?php 

$tableStyle->setBodyRegionCellStyle($cellStyle);

Character Styles

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

<?php

use IDML\Content\Style\CharacterStyle;

$characterStyle = new CharacterStyle();

$content->add($characterStyle);

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

Since IDML-Creator version 4.0, you can use the Factory to create and register the CharacterStyle:

$characterStyle = $factory->createCharacterStyle();

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

<?php 

$characterStyle->setNextStyle($followingCharacterStyle);

Object Styles

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

<?php

use IDML\Content\Style\ObjectStyle;

$objectStyle = new ObjectStyle();

$content->add($objectStyle);

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

Since IDML-Creator version 4.0, you can use the Factory to create and register the ObjectStyle:

$objectStyle = $factory->createObjectStyle();

An ObjectStyle object can be used in other elements, for example:

<?php 

$textFrame->setAppliedObjectStyle($objectStyle);

Paragraph Styles

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

<?php

use IDML\Content\Style\ParagraphStyle;

$paragraphStyle = new ParagraphStyle();

$content->add($paragraphStyle);

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

Since IDML-Creator version 4.0, you can use the Factory to create and register the ParagraphStyle:

$paragraphStyle = $factory->createParagraphStyle();

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

<?php 

$paragraphStyle->setNextStyle($followingParagraphStyle);

Table Styles

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

<?php

use IDML\Content\Style\TableStyle;

$tableStyle = new TableStyle();

$content->add($tableStyle);

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

Since IDML-Creator version 4.0, you can use the Factory to create and register the TableStyle:

$tableStyle = $factory->createTableStyle();