Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

380
Vistas
PHP Word - Remove placeholder from template so it does not leave a gap (blank line)

I'm using PHPWord to generate reports based on a template.

I replace placeholders in that template

$templateProcessor = new TemplateProcessor('template.docx');
$templateProcessor->setValue('placeholder_name', 'value5123');

and save the new file

$templateProcessor->saveAs('report.docx');

Pretty straightforward.

However, there are some values which are optional, so they leave stray placeholders behind, and the best I've been able to do is replace them with an empty string, which still leaves blank lines.

Is there a way to remove the placeholder expression altogether and prevent it (and the blank line) from showing in the final file?

Thanks

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda