-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Issue with Text Replacement in Multi-Line Text Boxes #224
Comments
The issue comes from the wrong implementation of WordTextBox Text and WordParagraph properties. Those should actually be lists. This should be fixed in: OfficeIMO/OfficeIMO.Word/WordTextBox.cs Lines 67 to 105 in e081e2a
Instead of first child we should get all runs and and create List and List. After that everything should be fine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am experiencing a problem with the text replacement functionality within multi-line text boxes using OfficeImoWord. Specifically, the function only recognizes and modifies placeholders in the first line of a text box, neglecting any placeholders in subsequent lines. This issue is impacting our ability to generate dynamic documents efficiently, where placeholders span multiple lines within text boxes.
Detailed Issue Description:
In scenarios where I attempt to replace placeholders across multiple lines within a single text box, only the placeholders in the first line are detected and replaced. Any subsequent placeholders that match the replacement criteria remain unaffected. This behavior suggests that the text replacement function may not be fully iterating through all text segments within a text box. During my debugging sessions, I found that the TextBoxes array, which should contain all lines of text within a text box, only includes text from the first line. This observation indicates that the function responsible for populating this array might not be capturing the entire content of text boxes, thereby affecting the completeness of the text replacement process.
Code Snippet Demonstrating the Issue:
Here is picture of textbox in word:
![image](https://private-user-images.githubusercontent.com/66207212/328807144-2b6d3046-5474-496a-a17a-07fd9a467e35.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1NTYyNjAsIm5iZiI6MTcyMTU1NTk2MCwicGF0aCI6Ii82NjIwNzIxMi8zMjg4MDcxNDQtMmI2ZDMwNDYtNTQ3NC00OTZhLWExN2EtMDdmZDlhNDY3ZTM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIxVDA5NTkyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZkYWJmMThlYjE0MWU4NTZjYjZiZjQ0YmFhOGU5MDBkNTJhYWFlOTQ1MjZiOWEwYjliZTc1MDRlMmU5MzZiMmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.YdG4XiFRMQZ-fE_GtI8lrcNELL9Q5JPJumpbwWGwJSE)
and here is result of my code:
![image](https://private-user-images.githubusercontent.com/66207212/328807038-c7b2c00d-ac82-4184-972f-5834a04f064b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1NTYyNjAsIm5iZiI6MTcyMTU1NTk2MCwicGF0aCI6Ii82NjIwNzIxMi8zMjg4MDcwMzgtYzdiMmMwMGQtYWM4Mi00MTg0LTk3MmYtNTgzNGEwNGYwNjRiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIxVDA5NTkyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFhM2ZjYzM4NjBmZGU5NzNmZjljMjNiNzJlMGRiNTlmZjc2NzBkOGM1YTExNjQxOTFjN2E1OWRlYzk3OTQ2ZjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.2gab6PLQNeLDLp4kkvi5GB4uLBAEVDYvR6qTvB2Q1V4)
Steps to Reproduce:
Create a Word document and insert a text box.
Could you please investigate this issue? I would appreciate guidance on whether this is a known limitation, and if there are any potential workarounds or upcoming fixes. Additionally, information on when a fix might be expected would be highly beneficial.
Technical Environment:
OfficeIMO Version: OfficeIMO.Word Version="0.13.0"
Operating System: Windows 11
The text was updated successfully, but these errors were encountered: