Forum


Replies: 3   Views: 129
Cómo usar la propiedad headinglevel en un custom paragraph style

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.