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

Is there any way to set bookmark text? #160

Open
Riant opened this issue Aug 10, 2021 · 4 comments
Open

Is there any way to set bookmark text? #160

Riant opened this issue Aug 10, 2021 · 4 comments
Labels
feature request Issues that request new features to be added to OnlyOffice

Comments

@Riant
Copy link

Riant commented Aug 10, 2021

Do you want to request a feature or report a bug?
Request a feature

I need to change the bookmark text, for now, I can get bookmark range from document like below, but there is not any way to change the range text.

oRange = oDocument.GetBookmarkRange("bookmark1");
oRange.AddText(' xxx', 'after'); // I only can do that, but can not do something like SetText('xxx');

Is there any other API can do slimier things?

Thanks.

@ShockwaveNN
Copy link
Contributor

@askonev Please take a look

@askonev
Copy link
Member

askonev commented Aug 13, 2021

@Riant Hi! Created an enchancement #51952 in our private repository to extend bookmarking methods. But at the moment you can interact with the data for which the bookmark was created as a Range object to which all methods of the ApiRange class are applicable.

Possible solution to replace the data to which the bookmark references.

oDocument = Api.GetDocument(); 
oParagraph = oDocument.GetElement(0); 
oParagraph.AddText( "ONLYOFFICE Document Builder "); 
oRange = oDocument.GetRange(0, 9); 
oRange.AddBookmark("Bookmark");

oBookmarkRange = oDocument.GetBookmarkRange("Bookmark");
oBookmarkRange.Delete();

oRange = oDocument.GetRange(0, 0);
oRange.AddText('Api methods for ');
oRange.AddBookmark("Bookmark_2");

ver. 6.3.2.8

@Riant
Copy link
Author

Riant commented Aug 17, 2021

@askonev I need to use this api in plugin, so your solution does not make scene for a document which uploaded by user, because we can not get the deleted bookmark range, and it is not (0, 0) in most cases.

So we need a ApiRange method to do that.

Thanks.

@ShockwaveNN ShockwaveNN added the feature request Issues that request new features to be added to OnlyOffice label Aug 17, 2021
@askonev
Copy link
Member

askonev commented Aug 18, 2021

@Riant, I understand you. At the moment, it remains only to wait for the decision of the developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to OnlyOffice
Projects
None yet
Development

No branches or pull requests

3 participants