Fanspage

enter php in word

inforeceh.com. Okay, this time, the reader will share small and small information, that is, enter the php code in the word format that we have prepared, not change the php to the word format, but enter the php into the finished word format, this is usually used to create automatic receipts or others that require a special word format are prepared, which basically we want to display our database entered in the word or enter the form that we will submit to the word format.

okay, just go ahead and prepare the project, let me say that I will make a salary receipt, because for example so I don't need to use a database, I just need to enter it manually so that it's more simple and easy to use



what is needed is

1. DOCXTemplate class 0.1.10 by sergey.shuchkin@gmail.com

2. Word format that we have prepared

3. make php with the name receipt

1. Calling docxtemplate.class.php

include "docxtemplate.class.php";


2. take the format that we will paste

$ docx = new DOCXTemplate ('proof of salary.docx');



3. Entering data that we will paste


   $ total = "Rp." "52,000,000";

  $ basic salary = "Rp." "100,000";

  $ transport = "Rp". "200,000";

  $ incentive attendance = "Rp." "300,000";

  $ replacement = "Rp." "400,000";

  $ head = "Rp." "500,000";

  $ adjustment = "Rp." "600,000";

  $ tupoksi = "Rp". "700,000";

  $ walikelas = "Rp". "800,000";

  $ coordinator = "Rp." "900,000";

  $ Saturday = "Rp." "1,000,000";

  $ meal = "Rp." "900,000";

  $ memorization = "Rp." "8,800,000";





4. enter the data into word format
$ docx-> set ('exact', ''. $ exact. '');

$ docx-> set ('name', 'Muhammad Yusuf');

$ docx-> set ('month', 'January');

$ docx-> set ('year', '2019');

$ docx-> set ('basic salary', ''. $ basic salary. '');

$ docx-> set ('memorization', ''. $ memorization. '');

$ docx-> set ('adjustments', ''. $ adjustments. '');

$ docx-> set ('head', ''. $ head. '');

$ docx-> set ('coordinator', ''. $ coordinator. '');

$ docx-> set ('tupoksi', ''. $ tupoksi. '');

$ docx-> set ('walas', ''. $ walikelas. '');

$ docx-> set ('total', ''. $ total. '');

$ docx-> set ('saturday', ''. $ saturday '');

$ docx-> set ('transport', ''. $ transport. '');

$ docx-> set ('present', ''. $ incentive attendance. '');

$ docx-> set ('eat', ''. $ eat. '');

$ docx-> set ('replace', ''. $ substitute. '');


5. Download the word and give it the name of the download



$ docx-> downloadAs ('test.docx');

header ("Content-Type: application / msword");

header ("Content-Disposition: attachment; filename = test.docx");

readfile ('test.docx');




and that's all the source code you can download below, thank you.


DOWNLOAD

Post a Comment

0 Comments