Welcome Guest, Not a member yet? Register   Sign In
Export to Word based on Word template
#1

Hi, i know there are lots of ways to export data from table to pdf,word or excell.

But i want to export data from my table to ms word that already exist. Let say i have ms word contain text like this:
Name:
Age:
 So i want that data comes from table and then a new ms word will be generated based on that existing ms word and contain data name and age.

How to di that? Any library or something?
Thanks
Reply
#2

PHPOffice offers libraries for both Word and Excel.

I use the Excel library often and it works well once you get the hang of it. It is a little bit tricky integrating it with CI v3 but it's not rocket science. Just a few config items and lines of code to make CI utilize namespace to load the classes.

I have not used the Word library but expect it will function at least as well as the Excel lib.
Reply
#3

There are plenty of stable PHP libraries, free and paid, just google for them.
Few examples: https://github.com/PHPOffice/PHPWord or https://www.tinybutstrong.com/opentbs.php

However, very often you do not ned any fancy MS Word features. If all you need is to put some text with basic formatting that can be later opened in MS Word, you can do int into much simpler Rich Text Format (https://en.wikipedia.org/wiki/Rich_Text_Format). There is also a number of libraries with good enough support for RTF.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB