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

Add a Checkbox to a template #425

Closed
cbloss opened this issue Nov 13, 2014 · 14 comments
Closed

Add a Checkbox to a template #425

cbloss opened this issue Nov 13, 2014 · 14 comments
Milestone

Comments

@cbloss
Copy link

cbloss commented Nov 13, 2014

Hello!

Loving the power behind PHPWord by the way!!

I was wondering if there's a way to add a checkbox to a template. I've seen how to do it to a new document, but what about a template? I thought about going the Wingding symbol route, but haven't been able to figure out how to change font styles on a template (well besides opening it up in word and changing the font styles there, but Wingdings..well the symbols don't translate well.

Can anyone give an tips?

Thanks!


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ozilion
Copy link
Contributor

ozilion commented Nov 14, 2014

Hi, I was going to open this issue as well. I need to use checkbox in templates now and adding checkbox functionality to new documents was not hard thing and I think a little but not too hard to do it with template files. I dont know If someone else already done or trying to implement it but once I have enough spare time from work I am going to take a try.

@ozilion
Copy link
Contributor

ozilion commented Nov 18, 2014

Looks like no any news?

@cbloss
Copy link
Author

cbloss commented Nov 18, 2014

Hmm looks like.


On Nov 18, 2014, at 2:33 AM, Özcan ARSLAN notifications@github.com wrote:

Looks like no any news?


Reply to this email directly or view it on GitHub.

@cbloss
Copy link
Author

cbloss commented Nov 19, 2014

Ozilion, I don't know if this helps you any, but I just used the setValue and used __ or x's. I know this isn't an ideal solution, but it's something. :)

@ozilion
Copy link
Contributor

ozilion commented Nov 19, 2014

I am already doing that, writing variable words but the most correct way is to use checkbox and my client asking me to use checkbox.

@cbloss
Copy link
Author

cbloss commented Nov 19, 2014

I totally agree. :) Just wanted to give you a tip.


On Nov 19, 2014, at 2:19 AM, Özcan ARSLAN notifications@github.com wrote:

I am already doing that, writing variable words but the most correct way is to use checkbox and my client asking me to use checkbox.


Reply to this email directly or view it on GitHub.

@ozilion
Copy link
Contributor

ozilion commented Dec 2, 2014

Still waiting 🔢

1 similar comment
@ozilion
Copy link
Contributor

ozilion commented Dec 19, 2014

Still waiting 🔢

@yowrosales
Copy link

Still waiting

@ozilion
Copy link
Contributor

ozilion commented Sep 16, 2015

At least if we can set value of checkbox in template, would be great, too!

@ozilion
Copy link
Contributor

ozilion commented Nov 27, 2015

I've tried PHPDocx template features. They have function named thickChecboxes to set value of specified checkboxes in templates. Here is the sample code from their trial pro package.

setLanguage('tr_TR'); $variables = array('check1' => 1, 'check2' => 0, 'check3' => 1); $docx->tickCheckboxes ($variables); $docx->createDocx('example_tickCheckboxes_1'); This function uses variable entered in statusText field of checkbox and working like a charm as we expected too 👍 :) I don't know if already PHPWord has similar feature but may be we can also implement such a way. I could use PHPDocx to check checkboxes but it takes so long time to process. As an example with PHPWord i can finish a job in 10 seconds, with PHPDocx it takes around 2 min and i tested without using tickCheckbox function.

@Blue-QAQ
Copy link

用setValue把关键字替换成xml代码
//1 or 0
class checkbox{
public function value($value)
{
if ($value){
return '<w:sdt><w:sdtPr><w:rPr><w:rFonts w:eastAsia="华文仿宋" w:hint="eastAsia" /><w:sz w:val="21" /></w:rPr><w:id w:val="-310866052" /><w15:appearance w15:val="hidden" />w14:checkbox<w14:checked w14:val="1" /><w14:checkedState w14:val="0052" w14:font="Wingdings 2" /><w14:uncheckedState w14:val="00A3" w14:font="Wingdings 2" /></w14:checkbox></w:sdtPr><w:sdtContent><w:r><w:rPr><w:rFonts w:eastAsia="华文仿宋" w:hint="eastAsia" /><w:sz w:val="21" /></w:rPr><w:sym w:font="Wingdings 2" w:char="F052" /></w:r></w:sdtContent></w:sdt>';
}
else{
return '<w:sdt><w:sdtPr><w:rPr><w:rFonts w:eastAsia="华文仿宋" w:hint="eastAsia" /><w:sz w:val="21" /></w:rPr><w:id w:val="-310866052" /><w15:appearance w15:val="hidden" />w14:checkbox<w14:checked w14:val="1" /><w14:checkedState w14:val="0052" w14:font="Wingdings 2" /><w14:uncheckedState w14:val="00A3" w14:font="Wingdings 2" /></w14:checkbox></w:sdtPr><w:sdtContent><w:r><w:rPr><w:rFonts w:eastAsia="华文仿宋" w:hint="eastAsia" /><w:sz w:val="21" /></w:rPr><w:sym w:font="Wingdings 2" w:char="F0A3" /></w:r></w:sdtContent></w:sdt>';
}
}
}

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@github-actions github-actions bot added the Stale label Nov 18, 2022
@Progi1984 Progi1984 removed the Stale label Nov 18, 2022
@Progi1984 Progi1984 added this to the 1.2.0 milestone Nov 27, 2023
@Progi1984
Copy link
Member

Fixed by #2509

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

No branches or pull requests

5 participants