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

Unable to get cell value outside of command scope #154

Open
vese opened this issue May 5, 2021 · 4 comments
Open

Unable to get cell value outside of command scope #154

vese opened this issue May 5, 2021 · 4 comments

Comments

@vese
Copy link

vese commented May 5, 2021

Hi! I need to parse value from cell and display it in plugin's window.
How can I do this?

document.getElementById("parse").onclick = function () {
  callCommand(function () {
    const value = Api.ActiveSheet.ActiveCell.Value;
    // need to get value outside of command scope
  }, false);
};

If use onCommandCallback I also can't get the value

window.Asc.plugin.onCommandCallback = function (returnValue) {
//returnValue is null

}

If use executeMethod I get returnValue in onMethodReturn for some methods, e. g. GetFontList

  window.Asc.plugin.executeMethod('GetFontList');

But I can't get cell value. ('GetActiveSheet', 'GetActiveCell')
Is there any method to get cell value?

@ShockwaveNN
Copy link
Contributor

@askonev Please take a look

@vese
Copy link
Author

vese commented May 12, 2021

It is possible to get selected value if specify "initOnSelectionChanged": true and "initDataType": "text" or "initDataType": "html" in config.json.
But it seems like workaround instead of an actual way to get value.
Also it is impossible to get selected cells adresses this way because init data has no this information

@askonev
Copy link
Member

askonev commented Jun 2, 2021

Hello @vese. This is exactly how the implementation of data access from the editor to the plugin was conceived. I think you have already familiarized yourself with the implementation of the Thesaurus plugin in which this configuration is used.

But direct access to the cell address is not implemented, but you can add it to the cell using Api methods and then take the data into the plugin.

@vese
Copy link
Author

vese commented Jun 3, 2021

Hello @askonev. Is it possible to add parameters to callbacks from callCommand ONLYOFFICE/sdkjs#1964 ?

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

3 participants