Contentype voor word

Pagina: 1
Acties:

  • thijsc
  • Registratie: Augustus 2000
  • Laatst online: 22-12-2023
Ik probeer een word document rechtstreeks van een webpagina te starten via een jsp. De jsp zet de headers en geeft het word document terug.

Ik wil nu graag dat het document direct geopend wordt in een word venster. Standaard opent word het document helaas in de frame waarin het document geladen wordt.


Weet iemand een header o.i.d. om dit te bereiken?

  • chem
  • Registratie: Oktober 2000
  • Laatst online: 27-08 13:53

chem

Reist de wereld rond

*denk*
zet een Content Disposition: attachment in, gok ik...

Klaar voor een nieuwe uitdaging.


  • sjroorda
  • Registratie: December 2001
  • Laatst online: 14:29
content type word-doc is application/ms-word (of zonder streepje, weet ik zo gauw niet)

  • SchizoDuckie
  • Registratie: April 2001
  • Laatst online: 18-02-2025

SchizoDuckie

Kwaak

Dit stukje php viewt óf een ppt, of een .doc :)
PHP:
1
<?function handleexecute($filename, $ppt, $doc){  if (strstr($HTTP_USER_AGENT, "MSIE"))      {        $attachment = "";      }    else      {        $attachment = " attachment;";      }    $size = filesize("$filename");    $fh = fopen("$filename", "r");        if ($ppt == 'true')     {     header("Content-Type: application/mspowerpoint");    header("Content-Disposition:$attachment filename=$doc.ppt");    }    else if ($ppt == 'false')    {    header("Content-Type: application/msword");    header("Content-Disposition:$attachment filename=$doc.doc");    }    header("Content-Transfer-Encoding: binary");    fpassthru($fh);    exit; }?>

hope this helps :)

Stop uploading passwords to Github!


  • thijsc
  • Registratie: Augustus 2000
  • Laatst online: 22-12-2023
Content-Type: application/msword had ik al door.

Content Disposition: attachment ga ik morgen eens proberen.

Dus jullie horen wel wat het geworden is ;)

  • Juup
  • Registratie: Februari 2000
  • Niet online
Dit gaat niet werken omdat het aan de client kant ingesteld staat hoe msword docs te openen. Je kunt dit voor zover ik weet niet met de header regelen.

Een wappie is iemand die gevallen is voor de (jarenlange) Russische desinformatiecampagnes.
Wantrouwen en confirmation bias doen de rest.

Pagina: 1