PhpWord doesn't replace text

前端 未结 7 1473
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-14 09:10

I have a docx file and I need to replace some text. This is done inside codeigniter framework; here is the code:

$this->load->library(\'word\');       
$te         


        
7条回答
  •  粉色の甜心
    2021-02-14 09:47

    It turns out that when you add text to a word file, it sometimes creates extra tags in the underlying xml file. So (pseudo code) ${NAME} can become ${NAME}

    Because of this, phpword can't find your needle.

    I'm using a mac with microsoft word and i can just cut all the contents of the word file and paste them again.

    Word will than recreate the underlying xml file in which ${NAME} is 1 tag instead of 3.

提交回复
热议问题