Link to home
Start Free TrialLog in
Avatar of nishu883
nishu883

asked on

Convert file into excel and word in linux

hi ,
i want to convert my file into excel and word format in linux how can i do that.
whe i used to work in windows i was doing like
inmy file i.e
header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

now in linux
im using OpenOffice.org Calc and writter so how can i do that
thanx
ASKER CERTIFIED SOLUTION
Avatar of WoodyRoundUp
WoodyRoundUp

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nishu883
nishu883

ASKER

hi,
i think that was not solu bcz in wondows v write
header("Content-Type: application/vnd.ms-excel");
that is for microsoft excel but in llinux we r using OpenOffice.org Calc so what should be written in that place
Thanx
maybe these ones:

application/vnd.oasis.opendocument.spreadsheet        
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi,
Thanx for the excellent support,
But my code is not working.
Actually my code is lik this
tabexcel.php
<html>
      <head>
            <title> excel File</title>
            <script language="javascript">
            function code(){
                  
                  document.test.action = "test.php";
                  document.test.submit();
            }
            
            </script>
      </head>
      <body>
            <form name="test">
            
            <input name="Generate" type="button" value="Generate" onClick="javascript:code();">
            </form>
            
            </body>
            </html>

test.php

<?php
$query = "select firstname,lastname,salary from trainee_emp";
      $db_conn = ocilogon( "..", "..", "..." );
      $parsed = ociparse($db_conn, $query);
      ociexecute($parsed);
      $nrows = ocifetchstatement($parsed, $result);
$data = "FIRSTNAME\tLASTNAME\tSALARY\n";   //This is use to make column title

if($nrows!=0){
    for ($i = 0; $i < $nrows; $i++ ){
     $fn = $result["FIRSTNAME"][$i];
     $ln  = $result["LASTNAME"][$i];
     $sal = number_format($result["SALARY"][$i],   2);

        $data .= "$fn\t$ln\t$sal\n";  // This will generate data into csv format
       
    }
}
header("Content-type: application/vnd.sun.xml.calc");
   //header("Content-disposition: csv.xls");
   print $data;
   exit;  
?>

When i run this code in windows and write header("Content-type: application/vnd.ms-excel"); it works properly but when i run it n linux and write header("Content-type: application/vnd.sun.xml.calc");
it doesnt work so pl tell me what is d solution.
thanx
did you try this?

application/vnd.oasis
ya i even try that thing  llike header("Content-type: application/vnd.oasis.opendocument.spreadsheet");
but it didnt work
so any other solu.
Is there any mistake in my code
pl let me know
thanx
i mean, without the opendocument.spreadsheet?
just vnd.oasis?

if it works in windows,it shall work in Linux. There should not be any code problem.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
Split: WoodyRoundUp & joshlrogers

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Huji
EE Cleanup Volunteer