I exported data from php page to word document but the problem is the header is not available in all pages....
Header is present in the first page but not in the next pages of the word document.....
Here is my code,
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>