Closed startewho closed 1 year ago
So I have some questions, because that seems like a very cool PR
We are right now using CleanupDocument() to potentially clear paragraphs that are the same and therefore allow for better search/replace. But if I understand you right, with your code we don't need to do that anymore? Right?
What happens if you are searching for Project Name which is not cleaned up because it's 2 different styles (say Red, Green) and you replace ProjectName to something else? It could be even more confusing if you replace string that is over 2 or more paragraphs, having different styles - how would it apply?
So I have some questions, because that seems like a very cool PR
- We are right now using CleanupDocument() to potentially clear paragraphs that are the same and therefore allow for better search/replace. But if I understand you right, with your code we don't need to do that anymore? Right?
yes.it does not needed.
- What happens if you are searching for Project Name which is not cleaned up because it's 2 different styles (say Red, Green) and you replace ProjectName to something else? It could be even more confusing if you replace string that is over 2 or more paragraphs, having different styles - how would it apply?
it use the first para style.and the last para will be empty. the mid paras will be remove usually.when we replace string.it use the same style most of time
Till now, Office IMo can's find and replace the string from mutil para. after search the web .found two source to do it
Search and Replace Text in an Open XML WordprocessingML Document | Eric White
https://github.com/nissl-lab/npoi/blob/32435d9485181a08f6993d3e94c10a70e5bb810a/ooxml/XWPF/Usermodel/XWPFParagraph.cs#L1307C22-L1307C22
the import thing is found the string location index of paras.
Also modify the wrong test and examples.
Before
After
![image](https://github.com/EvotecIT/OfficeIMO/assets/898009/837dbc20-6a9c-4867-b117-f169db8bd8be)