hi pals,
Im doing in-home project such that a document is being generated on the values i give in html document.

how can i include header and footer for the word document by php code .
MY cod for generating document is


<?php
$str=$_POST.".doc";
header("Content-Type: application/vnd.ms-word");
header("content-disposition: attachment;filename=$str");?>
<html>
<body leftmargin="30px" topmargin="30px" marginwidth="50px" marginheight="50px">
This is test word document.
</body>
</html>

thanks in advance

Recommended Answers

All 2 Replies

I don't think that this is possible. If you find a way I hope that you'll post it.

I tried some reverse engineering by using the html output from word for a document with a header and footer. The best I could get was the header and footer listed as part of the body of the document before and after the actual text. HTML doesn't have an equivalent feature so I think that this is really an internal Word feature that you probably can't access by giving it formatted input.

thanks for the reply,,,

but i have many check boxes in my first page which generates word file.. If i check that checkbox 5 lines will be added to my word document... In that case How can i fix my header and footer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.