createCharacterStyle
- addBibliography
- addBookmark
- addBreak
- addCaption
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addIndex
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addRuby
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableAuthorities
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- markEntry
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- importTheme
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDecimalSymbol
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
createCharacterStyle
TRIAL / ADVANCED / PREMIUM
Creates a new Word character style.
Description
public createCharacterStyle ( string $name [, array $styleOptions = array() ])
This method allows the generation of custom character styles that may be later used in combination with, for example, the addText method.
Parameters
name
A string with the name of the Word style that you are creating.
styleOptions
This is an array including all the available styling options.
| Key | Type | Description |
|---|---|---|
| bold | bool | If true the text will be shown in bold characters. |
| caps | bool | If true displays text in capital letters. |
| characterBorder | array |
Adds a border to the character
|
| color | string | Hexadecimal color value: 'FF0000', '000000'... |
| doubleStrikeThrough | bool | If true displays text in doubleStrikeThrough. |
| em | string | Emphasis mark type: 'none', 'dot', 'circle', 'comma', 'underDot' |
| emboss | bool | Emboss style. |
| font | string or array |
string type: font family: 'Arial', Calibri'...
array type:
|
| fontSize | int | Text size in half-points: 8, 9, 10... Multiply by 2 to get the same size as using the fontSize property with addText and other methods. |
| hidden | bool | Hide style from user interface. |
| italic | bool | If true displays the text in italics. |
| locked | bool | Style cannot be applied. |
| next | string | Style for next paragraph. |
| noProof | bool | Ignore spelling and grammar errors. |
| outline | bool | Outline style. |
| position | int | Position value. Positive value for raised and negative value for lowered. |
| semiHidden | bool | Hide style from main user interface. |
| shadow | bool | Shadow style. |
| strikeThrough | bool | If true displays text in strikethrough. |
| subscript | bool | If true displays text in subscript. |
| superscript | bool | If true displays text in superscript. |
| underline | string | Underlines text. Possible values are: 'single', 'words', 'double', 'dotted', 'dash' and 'wave'. |
| unhideWhenUsed | bool | Remove semi-hidden property when style is used. |
| vanish | bool | Uses a vanish style. |
| vertAlign | string | Vertical alignment. Possible values are: 'baseline', 'subscript' and 'superscript'. |
Release notes
- phpdocx 16.0:
- font option allows using an array to set all font types (ascii, hAnsi, eastAsia, cs).
- phpdocx 12.5:
- emboss, noProof, outline, shadow, suppressLineNumbers and vertAlign options.
- phpdocx 12.0:
- hidden, semiHidden, unhideWhenUsed, locked and next options.
- phpdocx 7.5:
- new method.
