Menu

fatal bug - logged in

2015-02-07
2015-02-07
  • Milan Uhrák

    Milan Uhrák - 2015-02-07

    Hi, this library is realy handy and full-featured. One word : thanks !

    Problem :
    my code looks like this (like in tutorial ):
    $filename = 'helloworld.odt'
    $d = new ODT::getInstance();
    $pStyle = new ParagraphStyle('myPStyle');
    $pStyle->setLineHeight('1cm');
    $p = new Paragraph($pStyle);
    $p->addText(' oh my god ! it works !! ' );
    $d->output($filename);

        header("Pragma: public"); 
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Content-Description: File Transfer");
        header("Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document");
        header('Content-Disposition: attachment; filename="'.basename($filename).'"');
        header("Content-Transfer-Encoding: binary");
        header("Content-Length: ".filesize( $filename ) );
        readfile( $filename );
        die;
    

    This works fine, as expected ..
    whea I added
    $pStyle->setTextAlign(StyleConstants::CENTER);

    downloaded document was opened in OpenOffice like simple ascii text but corrupted.

    Short look at results shows generated file on web server has 1614 bytes, downloaded 1616. Hexdump show the difference is in first two bytes, 0x0D 0x09 added on begin of downloaded file.

    after about hour or researchs i found, class.styleconstant.php has after last

    ?>

    newline + tab

    chars

    Please repair this for others

    thanks
    Milan

     
  • Anonymous

    Anonymous - 2019-01-25
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2019-02-24
    Post awaiting moderation.

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.