Open nicewillsuccess opened 4 months ago
var oDocument = Api.GetDocument(); var oParagraph = oDocument.GetElement(2); var aSearch = oParagraph.Search("text"); aSearch[0].SetBold(true);
@nicewillsuccess bug 66725
has been fixed on version 8.1
Version 8.1.1 is released so I close this issue. Feel free to comment or reopen it if you got further questions.
版本 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.
@askonev, Please take a look.
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
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.