Skip to content

Feature: add limit option to cloneBlock #2641

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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

moghwan
Copy link
Contributor

@moghwan moghwan commented Aug 4, 2024

Description

This PR adds a limit parameter to the cloneBlock function. This will help to minimize processing when the limit is needed for a bulk cloning operation, especially when there are multiple occurrences of the same block in the document.

example:

$templateProcessor = new TemplateProcessor('sample.docx');

// current
// This will clone all occurrences of the "block" in the document
$templateProcessor->cloneBlock('block', 3);

// improvement
// assuming we want to clone only the first occurrence of the "block":
$templateProcessor->cloneBlock('block', 3, true, false, null, 1);

Checklist:

  • My CI is 🟢
  • I have covered by unit tests my new code (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes
  • I have updated the changelog

@coveralls
Copy link

coveralls commented Aug 4, 2024

Coverage Status

coverage: 96.667% (-0.09%) from 96.757%
when pulling 9eea948 on moghwan:feat/add-limit-to-cloneblock
into 0ab0b49 on PHPOffice:master.

@moghwan moghwan marked this pull request as ready for review July 4, 2025 16:59
@moghwan
Copy link
Contributor Author

moghwan commented Jul 4, 2025

hello @Progi1984, I've updated my branch with master, do my improvments require to update the unit test even all is green ? let me know if so!

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

Successfully merging this pull request may close these issues.

2 participants