Forum


Replies: 3   Views: 179
Cómo usar la propiedad headinglevel en un custom paragraph style
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 05-08-2024 - 07:06

Hola,

Con la versión de phpdocx que estás usando, en lugar de headingLevel, prueba a utilizar outlineLvl con createParagraphStyle:

$heading2_anexo_style = array(
    'color' => '#FF0000',
    'spacingTop' => 20,
    'outlineLvl' => 2,
    'font' => 'Arial',
    'fontSize' => 24,
    'bold' => 'on',
    'smallCaps' => 'on',
);
$docx->createParagraphStyle('title2_anexo', $heading2_anexo_style);

O añade la opción headingLevel al crear el texto:

$titulo = new WordFragment($docx, 'document');
$titulo->addText('Titulo 2', array('pStyle' => 'title2_anexo', 'fontSize' => 22, 'textAlign' => 'center', 'underline' => 'single', 'headingLevel' => 2));

Saludos.