Skip to content
This repository was archived by the owner on Sep 28, 2018. It is now read-only.
This repository was archived by the owner on Sep 28, 2018. It is now read-only.

Replace block with keeping styles #20

Description

@michmzr

Hi,

I want to replace block with checkbox xml. Plugin replace block in docx, but styles are set on default. I would like to keep original styles for block. How to do this?

 $tickCheckbox = '
                    <w:sdt>
						<w:sdtPr>
							<w14:checkbox>
								<w14:checked w14:val="'.($strValue ? 1 : 0).'"/>
								<w14:checkedState w14:val="0052" w14:font="Wingdings 2"/>
								<w14:uncheckedState w14:val="2610" w14:font="MS Gothic"/>
							</w14:checkbox>
						</w:sdtPr>';
                if($strValue) {
                    $tickCheckbox .= '		
                        <w:sdtContent>
							<w:p>
								<w:pPr>
									<w:spacing w:line="240" w:lineRule="auto"/>
								</w:pPr>
								<w:r>
									<w:sym w:font="Wingdings 2" w:char="F052"/>
								</w:r>
							</w:p>
						</w:sdtContent>';
                }else {
                    $tickCheckbox .= '
                        <w:sdtContent>
							<w:p>
								<w:pPr>
									<w:spacing w:line="240" w:lineRule="auto"/>
								</w:pPr>
								<w:r>
									<w:rPr>
										<w:rFonts w:ascii="MS Gothic" w:eastAsia="MS Gothic" w:hAnsi="MS Gothic" w:hint="eastAsia"/>
									</w:rPr>
									<w:t>☐</w:t>
								</w:r>
							</w:p>
						</w:sdtContent>';
                }
		$tickCheckbox.=	'</w:sdt>';

                $objPdf->replaceBlock($keyName, $checkbox);

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions