Forum


Replies: 4   Views: 1178
Negrita en el texto que enlaza a la nota al pie
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 rmartinez  · 07-10-2020 - 11:18

Buenas.

En una nota al pie, no encuentro la manera de poner en negrita el texto del parámetro textDocument. He probado con un array con opciones, con un elemento WF y nada. ¿Podéis ponerme un ejemplo de cómo conseguirlo?

Gracias.

Saludos.

Posted by admin  · 07-10-2020 - 11:53

Hola,

Necesitas utilizar la opción footnoteMark (o la correspondiente para endnote) por ejemplo:

$footnote->addFootnote(
    array(
        'textDocument' => 'footnote',
        'textFootnote' => $html,
        'footnoteMark' => array(
          'customMark' => '*',
          'bold' => true
        )
    )
);
                    

$text = array();
$text[] = array('text' => 'Here comes the ');
$text[] = $footnote;
$text[] = array('text' => ' and some other text.');

$docx->addText($text);

Saludos.

Posted by rmartinez  · 07-10-2020 - 14:30

Buenas.

Utilizando código similar al siguiente:

$footnote = new WordFragment($docx, 'document');
$footnote->addFootnote(
        array(
                'textDocument' => 'palabra',
                'textFootnote' => 'Descripción.',
                'footnoteMark' => array(
                  'bold' => true
                )
        )
);
$text = [['text' => 'Inicio ...'], $footnote, ['text' => '... fin.']];
$wf->addText($text);

tanto "palabra" como "Descripción", me aparecen en negrita. ¿No existe una manera de que solo 'palabra' aparezca en negrita?

Gracias.

Saludos.

Posted by admin  · 07-10-2020 - 15:29

Hola,

Ese es el comportamiento predeterminado de MS Word, heredar los estilos en footnotes/endnotes. Si quieres utilizar otros estilos tienes que definirlos, por ejemplo con un WordFragment como nuestro anterior ejemplo utiliza:

$htmlCode = '<p>Texto</p>';
$html->embedHTML($htmlCode);
$footnote->addFootnote(
    array(
        'textDocument' => 'footnote',
        'textFootnote' => $html,
        'footnoteMark' => array(
          'bold' => true
        )
    )
);
                    

$text = array();
$text[] = array('text' => 'Here comes the ');
$text[] = $footnote;
$text[] = array('text' => ' and some other text.');

Saludos.

Posted by rmartinez  · 07-10-2020 - 16:20

Ok. Ahora muestra el formato como quería.

Gracias.

Saludos.