Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3787356
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:49:42+00:00 2026-05-19T11:49:42+00:00

I am able to generate a Microsoft word file, but I want the data

  • 0

I am able to generate a Microsoft word file, but I want the data in table structure. I have used an HTML table tag in PHP, but the output does not look satisfactory. In the table are a lot of cellspacing and cellpadding even if I have initialize them to zero space. Any idea how can I solve this?

here goes my code

    header("Content-type: application/vnd.ms-word");
    header("Content-Disposition: attachment;Filename=document_name.doc");
    $now_date = date('d-m-Y H:i');
    echo "<html>";
    echo "<body>";
    echo "</body>";
    echo "<head>";
    echo "<div>Seminarthema:</div>\n";
    echo "<div>Termin:$now_date</div>";
    echo "<br></br>";
    echo "<div style='size:20px;'><h2>Teilnehmerliste</h2></div>";
    echo "<table border='1' cellpadding='0' cellspacing='0'>
            <tr><th>Name</th><th>Vorname</th><th>Buchungskreis</th><th>Kurs-ID</th><th>Teilgenommen</th></tr>";     
    $students = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('*','tx_training_Registration','hidden=0 AND deleted=0');
    $countstud = $GLOBALS['TYPO3_DB']->sql_num_rows($students); 
    if($countstud){ 
        while($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($students)){
            echo "<tr>";
                echo "<td>".utf8_decode($row2['firstname'])."</td>";
                echo "<td>".utf8_decode($row2['lastname'])."</td>";
                echo "<td>".utf8_decode($row2['companycode'])."</td>";
                echo "<td>".utf8_decode($row2['trainingid'])."</td>";
                echo "<td>".utf8_decode($row2[' status'])."</td>";
            echo "</tr>";
        }   
    }                                 
    echo  "</table>";   
    echo "</head>";
    echo "</html>"; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T11:49:43+00:00Added an answer on May 19, 2026 at 11:49 am

    Why not consider creating a “real” Word document rather than a “make-believe that HTML is actually Word” file. Take a look at PHPWord.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

to export some data i want to be able to generate an html output.
I have an NSIS based installer that I need to be able generate slightly
Is there any API or command-line able to generate a VSTemplate file from a
I have two textures generated using a fragment shader. I want to be able
Is it possible to run a script using Microsoft.SqlServer.Management.Smo? I am able to generate
I have a build script (.bat) that invokes MSBUILD ( C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe ) that used
My product needs to be able to generate .snk files (without having Microsoft SDKs
I wish to be able to generate URL variables like this: http://example.com/195yq http://example.com/195yp http://example.com/195yg
I'd like to be able to generate a class that inherits from BitmapData at
I want to be able to email a report daily from a glpi database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.