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

ApiRange.GetAllParagraphs - Returns more paragraphs than actually in the range. #2920

Open
1 task done
hdijkema opened this issue Oct 14, 2024 · 4 comments
Open
1 task done
Labels
confirmed-bug Issues with confirmed bugs

Comments

@hdijkema
Copy link

This issue is unique.

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

Operating System of DocumentServer

Windows Server, Linux (DEB package), Docker

Version information

8.0.1

Expected Behavior

Look at the picture below.

afbeelding

The highlighted text is a bookmark. This bookmark has a range and if I select that range, I'll get the highlighted text selected.
Also the range has been highlighted and that goes well.

Now, I want to check if the range of the bookmark intersects with the selected text ('And' in the picture).

If I check that with the Intersect method, I do not get 'null' as an output.. Instead, I get a new range.
I requested all paragraphs of the range and suddenly, this paragraph with 'And' in it is part of the range.

That's inconsistent. When I highlight the range it works as expected. When I select the range, it will only select the tow cells, however, when I try to check if some selected range is part of the range, it will incorrectly report it is part of the range.

Actual Behavior

Expected is that the selected range does not intersect with the highlighted range (i.e. the bookmark range).

Reproduction Steps

  1. Create a table as in the picture.
  2. make a bookmark consisting of two cells in column 2.
  3. select text in a cell in column 1, adjacent to the cell in column 2. It must be somewhere 'in the line of cells from left to right/next row left to right, etc.).
  4. check if the selected range is part of the bookmark range.

Additional information

No response

@lemonowl
Copy link

Hi, @hdijkema!
I tried to repeat your case in 8.0.1-50:

I created a table and added bookmarks for two cells in column 2 (I used scripts below for it)

var oDocument = Api.GetDocument();
var oRange = oDocument.GetRangeBySelect();
oRange.SetHighlight('yellow')
oRange.AddBookmark('Bookmark1');
var oDocument = Api.GetDocument();
var oRange = oDocument.GetRangeBySelect();
oRange.SetHighlight('green')
oRange.AddBookmark('Bookmark2');

After that I selected a text in the third cell and checked intersections in Colsole tab in DevTools.

oDocument.GetAllBookmarksNames();
oRange1 = oDocument.GetBookmarkRange('Bookmark1');
oRange2 = oDocument.GetBookmarkRange('Bookmark2');
oRange3 = oDocument.GetRangeBySelect();

oRange1.IntersectWith(oRange2);
oRange1.IntersectWith(oRange3);
oRange2.IntersectWith(oRange1);
oRange2.IntersectWith(oRange3);
oRange3.IntersectWith(oRange1);
oRange3.IntersectWith(oRange2);

All intersections returned null
image

Could you send a more details about your issue? Attach your script if possible.

@hdijkema
Copy link
Author

I see what you have done, but this is not exactly the situation I tried to make clear. Please look at the picture below:

afbeelding

I integrated a plugin that when you click on the element in the "flower" at the right, the bookmark is 'selected' in the document at the left. You can see that the selected range, i.e. the bookmark, consists of text in two cells of the table. You created two bookmarks in two different cells. I created one bookmark that ranges text in two cells.

(You also see a green rectangle, that is a hack on the caret position that blinks on and of green when the document scrolls to the selected bookmark, to make more clear where the selected bookmark is on the screen).

@lemonowl
Copy link

lemonowl commented Oct 22, 2024

Hi, @hdijkema!
Sorry for misunderstanding.
I could repeat your case and I created bug #71120 in our private bug tracking system.

@hdijkema
Copy link
Author

See also #2990

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs
Projects
None yet
Development

No branches or pull requests

3 participants