A few fixs

Apr 16, 2010 at 6:14 AM
Edited Apr 16, 2010 at 6:17 AM

Hello: I'm starting to use this library and I did some changes because I got some errors.

1) In PHPWord.php I replace PHPWORD_BASE_PATH line for this

/** PHPWORD_BASE_PATH */
if (!defined('PHPWORD_BASE_PATH')) 
{ 
define('PHPWORD_BASE_PATH', dirname(__FILE__) . '/');
}

because before changing it I got errors.

2) The option spaceAfter and spaceBefore is not set for PreservedText. That's why, in the file PHPWord/writer/Word2007/Base.php I added to the method _writePreserveText the next piece of code, after the if of align

$spaceBefore = $style->getSpaceBefore();
$spaceAfter = $style->getSpaceAfter(); 

if(!is_null($spaceBefore) || !is_null($spaceAfter)) 
{ 
        $objWriter->startElement('w:spacing'); 
        if(!is_null($spaceBefore)) 
        { 
             $objWriter->writeAttribute('w:before', $spaceBefore); 
        } 
        if(!is_null($spaceAfter)) 
        { 
             $objWriter->writeAttribute('w:after', $spaceAfter);
        } 
        $objWriter->endElement(); 
}

I hope have been clear enough .... sorry for my english.... is not good...

 

Grettings

Coordinator
Apr 16, 2010 at 3:54 PM

Thanks for the editing.

I will apply your changes to the next release.