hola a todos, necesito crear un documento con datos traidos de sql server, el problema es que no tengo ni idea de como lograrlo, estuve leyendo algo de la libreria phpWord pero no le entiendo, alguien me puede mostrar un ejemplo de como se hace un archivo word con php?
de antemano gracias
entre Desarrolladores
Recibe ayuda de expertos
Registrate y pregunta
Es gratis y fácil
Recibe respuestas
Respuestas, votos y comentarios
Vota y selecciona respuestas
Recibe puntos, vota y da la solución
Pregunta
alguien que tenga un ejemplo de como hacer un documento word con php y sql server
- preguntó
- Software
- 2967 Vistas
- 1 Respuestas
- abierta
1 Respuesta
Aquí tienes un ejemplo de uso de la librería phpWord para crear un documento:
// Include the PHPWord.php, all other classes were loaded by an autoloader
require_once 'PHPWord.php';
// Create a new PHPWord Object
$PHPWord = new PHPWord();
// Every element you want to append to the word document is placed in a section. So you need a section:
$section = $PHPWord->createSection();
// After creating a section, you can append elements:
$section->addText('Hello world!');
// You can directly style your text by giving the addText function an array:
$section->addText('Hello world! I am formatted.', array('name'=>'Tahoma', 'size'=>16, 'bold'=>true));
// If you often need the same style again you can create a user defined style to the word document
// and give the addText function the name of the style:
$PHPWord->addFontStyle('myOwnStyle', array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
$section->addText('Hello world! I am formatted by a user defined style', 'myOwnStyle');
// You can also putthe appended element to local object an call functions like this:
$myTextElement = $section->addText('Hello World!');
$myTextElement->setBold();
$myTextElement->setName('Verdana');
$myTextElement->setSize(22);
// At least write the document to webspace:
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('helloWorld.docx');
La fuente: Documentación oficial de phpWord.
Por favor, accede o regístrate para añadir un comentario.
Por favor, accede o regístrate para responder a esta pregunta.
En el blog
-
- 406873
- 1
- Jul 5, 2015
Sin Respuesta
-
- 99
- 0
- Mar 19
-
- 65
- 1
- Feb 26
-
- 155
- 0
- Ene 30
-
- 612
- 0
- Nov 7, 2023
-
- 260
- 0
- Sep 19, 2023
-
- 286
- 0
- Ago 21, 2023
-
- 365
- 0
- May 14, 2023
-
- 324
- 0
- Abr 21, 2023
- ver todas
Actividad Reciente
Santiago2610 comentó hace 6 días
Acualizar ChoiceField en djangoSantiago2610 preguntó Mar 19
Acualizar ChoiceField en djangogonzalss preguntó Feb 26
Script /boot/ scrapingParkJo preguntó Ene 30
No me deja instalar Oracleelporfirio respondió Ene 10
Actualizar la imagen con los datos devuelto en un …ovedg preguntó Dic 31, 2023
Actualizar la imagen con los datos devuelto en un …Ehdez preguntó Nov 7, 2023
Necesito en wordpress un pluging que me calcule la…pedrourday preguntó Sep 19, 2023
Alternativas a ThreeJS y BabylonJS?pedrourday preguntó Ago 21, 2023
¿Que tecnologias y lenguajes me recomiendan?Fabio respondió Jul 11, 2023
plugin de efecto circular 3d en imagenes
Ultimas Preguntas
Usuarios Top
- Leonardo-Tadei
- 227320 Puntos
- Peter
- 150460 Puntos
- white
- 75880 Puntos
- carlossevi
- 63580 Puntos
- magarzon
- 30650 Puntos
- pregunton
- 20400 Puntos
Todos los Usuarios Usuarios Nuevos
...