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

Alignment footer PreserveText #45

Closed
ottena opened this issue Dec 24, 2013 · 4 comments
Closed

Alignment footer PreserveText #45

ottena opened this issue Dec 24, 2013 · 4 comments
Assignees
Milestone

Comments

@ottena
Copy link

ottena commented Dec 24, 2013

Alignment of the PreserveText can only be done by entering an emty fontstyle array.
Leaving out the fontsyle array will result in left alignment of the text.

@Progi1984 Progi1984 modified the milestones: 0.7.3, 0.7.2 Mar 10, 2014
@ivanlanin
Copy link
Contributor

@ottena Sorry for the late response. I've tested the following code to the latest develop branch:

Test 1:

$footer = $section->createFooter();
$footer->addPreserveText(
    'Page {PAGE} of {NUMPAGES}', 
    array('color' => 'FF0000'),
    array('align' => 'center')
);

Test 2:

$footer = $section->createFooter();
$footer->addPreserveText(
    'Page {PAGE} of {NUMPAGES}',
    null,
    array('align' => 'center')
);

Both displayed correct centered alignment. You must enter alignment as part of the paragraph style, which is the third argument of the function:

$footer->addPreserveText($text, $styleFont = null, $styleParagraph = null)

Can you please test and inform us about the result? Thanks.

@ottena
Copy link
Author

ottena commented Mar 19, 2014

Hello Ivan,

Thanks for your reply.
It does not matter is is late because I am stil exploring the Word PHP
library.

By entering *null *as style, the alignment is correct.
If I leave it out , alignment is treated as style (I think) and therefore
always left.

Thanks for checking it out.
Problem solved.

Best Regards,
Alex Otten

2014-03-17 13:52 GMT+01:00 Ivan Lanin notifications@github.com:

@ottena https://github.com/ottena Sorry for the late response. I've
tested the following code to the latest develop branch:

Test 1:

$footer = $section->createFooter();$footer->addPreserveText(
'Page {PAGE} of {NUMPAGES}',
array('color' => 'FF0000'),
array('align' => 'center'));

Test 2:

$footer = $section->createFooter();$footer->addPreserveText(
'Page {PAGE} of {NUMPAGES}',
null,
array('align' => 'center'));

Both displayed correct centered alignment. You must enter alignment as
part of the paragraph style, which is the third argument of the function:

$footer->addPreserveText($text, $styleFont = null, $styleParagraph = null)

Can you please test and inform us about the result? Thanks.

Reply to this email directly or view it on GitHubhttps://github.com//issues/45#issuecomment-37811453
.

@ivanlanin
Copy link
Contributor

Your welcome, Alex. Glad it helps.

@Progi1984 Progi1984 added this to the 0.8.0 milestone Mar 24, 2014
@pawansharma13
Copy link

Hi Ivanlanin,

How can we add addPreserveText method in section. I want to add indexing in my doc file with page number.


Exp :
title 1 5
title 2 10
title 3 15
title 4 15
title 5 16


Plz help

Thanks
Pawan Sharma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants