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

Excuse me, when I use the Office API and the AddCommint() method under oRange, the selected range will be lost; #2897

Closed
1 task done
qzzhujixue opened this issue Sep 22, 2024 · 7 comments

Comments

@qzzhujixue
Copy link

qzzhujixue commented Sep 22, 2024

This issue is unique.

  • I have used the search tool and did not find an issue describing my bug.

Operating System of DocumentServer

Docker

Version information

8.1

Expected Behavior

Excuse me, when I use the Office API and the AddCommint() method under oRange, the selected range will be lost; For example, in the following text, I want to match the string "is Tom". If it ends with "is Tom", "is Tom" will lose its selection, but "is Tom" is not the end, so there is no problem

Actual Behavior

"is Tom" will lose its selection, but "is Tom" is not the end, so there is no problem

Reproduction Steps

No response

Additional information

评论-正常-0
评论-正常-1
评论-异常-0
评论-异常-1

@qzzhujixue
Copy link
Author

const aSearchs = oDocument.Search(content);
let oRange = aSearchs[0]
let oComment = oRange.AddComment(sText, sAuthor, sUserId);

@qzzhujixue qzzhujixue changed the title Excuse me, when I use the Office API and the AddCommint() method under oChange, the selected range will be lost; Excuse me, when I use the Office API and the AddCommint() method under oRange, the selected range will be lost; Sep 25, 2024
@lemonowl
Copy link

Hi, @qzzhujixue!
I checked ApiRange.AddComment method in DocumentServer version 8.1.3 and it works correct

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var aSearch = oDocument.Search("is Tom");
aSearch[0].AddComment("comment", "John Smith", "uid-1");

Could you text a little more details about what you need to do or attach whole script?

@Rita-Bubnova Rita-Bubnova added the waiting feedback Issues that we waiting to be answered from author of issue label Sep 27, 2024
@qzzhujixue
Copy link
Author

qzzhujixue commented Sep 28, 2024

Hi, @qzzhujixue! I checked ApiRange.AddComment method in DocumentServer version 8.1.3 and it works correct

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var aSearch = oDocument.Search("is Tom");
aSearch[0].AddComment("comment", "John Smith", "uid-1");

Could you text a little more details about what you need to do or attach whole script?

 var oRange = oDocument.GetRangeBySelect();


const content = "is tom"
 const aSearchs = oDocument.Search(content);

    for (let j = aSearchs.length - 1; j >= 0; j--) {
      const sAuthor = "机器人";
      const sUserId = "robot";
      const sText = "这是批注"
      let oComment = aSearchs[j].AddComment(sText, sAuthor, sUserId);
  }

@qzzhujixue
Copy link
Author

There may be a problem when the content I selected ends with 'is Tom'; Because my requirement is to annotate the content within the selected range, not the entire text

@qzzhujixue
Copy link
Author

image

@lemonowl
Copy link

lemonowl commented Oct 1, 2024

Hi, @qzzhujixue!
I tried to repeat it on version 8.1.3
I used GetRange + Select and after that added comment to Search result

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText('My name is Tom Riddle');
var oRange1 = oParagraph.GetRange(0, 14);
oRange1.Select();

var aSearch = oDocument.Search("is tom");
aSearch[0].AddComment("comment", "John Smith", "uid-1");

And the range is highlighted correctly
image

Could you record a video demonstrating the issue?

@Rita-Bubnova Rita-Bubnova removed the waiting feedback Issues that we waiting to be answered from author of issue label Oct 7, 2024
@Rita-Bubnova Rita-Bubnova added the waiting feedback Issues that we waiting to be answered from author of issue label Oct 8, 2024
@Rita-Bubnova
Copy link
Member

This issue was closed due no response.

@Rita-Bubnova Rita-Bubnova removed the waiting feedback Issues that we waiting to be answered from author of issue label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants