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

There might be an issue with oParagraph.Search #130

Open
nicewillsuccess opened this issue May 15, 2024 · 6 comments
Open

There might be an issue with oParagraph.Search #130

nicewillsuccess opened this issue May 15, 2024 · 6 comments
Labels
fixed-release Issues that fixed on next release, waiting to be released

Comments

@nicewillsuccess
Copy link

I'm encountering an issue while using the oParagraph.Search method. When I attempt to bold the entire search result (e.g., "text"), only part of the text, like "tex," is getting bolded instead of the full "text" as I expected.

@nicewillsuccess
Copy link
Author

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(2);
var aSearch = oParagraph.Search("text");
aSearch[0].SetBold(true);

@askonev
Copy link
Member

askonev commented May 21, 2024

@nicewillsuccess bug 66725 has been fixed on version 8.1

@Rita-Bubnova Rita-Bubnova added the fixed-release Issues that fixed on next release, waiting to be released label May 21, 2024
@Rita-Bubnova
Copy link
Member

Version 8.1.1 is released so I close this issue. Feel free to comment or reopen it if you got further questions.

@nicewillsuccess
Copy link
Author

版本 8.1.1 已发布,因此我关闭了此问题。如果您有更多问题,请随时发表评论或重新打开它。

I tried with the new version, but the issue persists. If a line break is added and then oParagraph.Search is used, it will select the line break, and the last text of the search won’t be included. If Delete() is called at this point, it will also delete the line break.

@Rita-Bubnova
Copy link
Member

@askonev, Please take a look.

@Rita-Bubnova Rita-Bubnova reopened this Sep 4, 2024
@nicewillsuccess
Copy link
Author

nicewillsuccess commented Sep 5, 2024

var oParagraphLineBreak = oDocument.GetElement( 2);
var oRun = Api.CreateRun();
oRun.AddLineBreak();
oParagraphLineBreak.AddElement(oRun);
oRun = Api.CreateRun();
oRun.AddText("hello");
oRun.SetFontSize(32);
oRun.SetShd("clear", 240, 230, 140);
oParagraphLineBreak.AddElement(oRun);
var oSearch = oParagraphLineBreak.Search("hello");
oSearch[0].Delete();
This is part of the code. I first added a line break, then added the text 'hello'. When using the Search method to find 'hello', the text returned by Search is '\rhell' instead of 'hello'. When calling Delete, it removes both the line break and 'hell'. @askonev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed-release Issues that fixed on next release, waiting to be released
Projects
None yet
Development

No branches or pull requests

3 participants