Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to add a link within a title. #275

Closed
alpha1125 opened this issue Jun 11, 2014 · 4 comments
Closed

Ability to add a link within a title. #275

alpha1125 opened this issue Jun 11, 2014 · 4 comments

Comments

@alpha1125
Copy link

If there is a work around, I have not been able to find it.

Thanks.

@ivanlanin ivanlanin added this to the 0.12.0 milestone Jun 11, 2014
@ivanlanin
Copy link
Contributor

Apply 'HeadingN' paragraph style to TextRun or Link. Sample code:

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->addTitleStyle(1, array('size' => 16, 'bold' => true));
$phpWord->addTitleStyle(2, array('size' => 14, 'bold' => true));
$phpWord->addFontStyle('Link', array('color' => '0000FF', 'underline' => 'single'));

$section = $phpWord->addSection();

// Textrun
$textrun = $section->addTextRun('Heading1');
$textrun->addText('The ');
$textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord', 'Link');

// Link
$section->addLink('https://github.com/', 'GitHub', 'Link', 'Heading2');

@alpha1125
Copy link
Author

Thank you, this probably should be an example somewhere in the docs. Works perfectly.

@ivanlanin
Copy link
Contributor

You're right. I think this suites well for the recipe part. I keep this open until someone puts this in. Thanks for the suggestion.

@ivanlanin
Copy link
Contributor

Recipe added: e9f8e88

@ivanlanin ivanlanin self-assigned this Jun 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants