I have to show in word doc link and comment on same word.
For eg - hello is a word which has "a href tag" and same word has some "comments" on it.
How can i achieve it?
TIA
🏷️ Limited Offer: 25% OFF 🏷️
First 100 purchases only — Special discount!
Use this coupon on checkout: PHPDXPJ_D1SC1N5T
Get it nowI have to show in word doc link and comment on same word.
For eg - hello is a word which has "a href tag" and same word has some "comments" on it.
How can i achieve it?
TIA
Hello,
You need to use a WordFragment and add it to the textDocument option. For example:
$docx = new CreateDocx();
$textFragment = new WordFragment($docx, 'comment');
$textFragment->addText('Text content.');
$linkFragment = new WordFragment($docx);
$linkFragment->addLink('Link to Google', array('url'=> 'http://www.google.com'));
$comment = new WordFragment($docx, 'document');
$comment->addComment(
    array(
        'textDocument' => array('text' => array($linkFragment)),
        'textComment' => $textFragment,
        'author' => 'PHPDocX Team',
    )
);
                    
$text = array();
$text[] = array('text' => 'Here comes the ');
$text[] = $comment;
$text[] = array('text' => ' and some other text.');
$docx->addText($text);
$docx->createDocx('output');Regards.