How to retain headers for all the pages of an exported word document in php?
Posted
by udaya
on Stack Overflow
See other posts from Stack Overflow
or by udaya
Published on 2010-03-29T05:21:12Z
Indexed on
2010/03/29
6:03 UTC
Read the original article
Hit count: 311
php
|codeigniter
Hi
I exported data from php page to word document but the problm is the header is not available in all pages
I got the same problem while i am exporting the datas to pdf but i got the result for that one by using fpdf library
In pdf i got the results like this
ex page1
slno name
1 udaya
2 sankar
In page 2
slno name
3 chendu
4 Akila
I want the same kind of result in word how to get that This is the function i used
function changeDetails()
{
$bType = $this->input->post('textvalue');
if($bType == "word")
{
$this->load->library('table');
$data['countrytoword'] = $this->AddEditmodel1->export();
$this->table->set_heading('Name','Country','State','Town');
$out = $this->table->generate($data['countrytoword']);
header("Content-Type: application/vnd.ms-word");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-disposition: attachment; filename=$cur_date.doc");
echo '<br><br>';
echo '<strong>CountryList</strong><br><br>';
print_r($out);
}
}
<? if(isset($countrytoword)) {
?>
<table align="center" border="0">
<tr>
<td>
Name
</td>
<td>
Country
</td>
<td>
State
</td>
<td>
Town
</td>
</tr>
<? foreach($countrytoword as $dsasffd)
{
?>
<tr>
<td><?= $dsasffd['dbName'] ?></td>
<td><?= $dsasffd['dbCountry']; ?></td>
<td><?= $dsasffd['dbState']; ?></td>
<td><?= $dsasffd['dbTown']; ?></td>
<? } } ?>
</tr>
</table>
© Stack Overflow or respective owner