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

How to obtain the data returned by callCommand? #2924

Open
1 task done
LiangKuan4451 opened this issue Oct 17, 2024 · 0 comments
Open
1 task done

How to obtain the data returned by callCommand? #2924

LiangKuan4451 opened this issue Oct 17, 2024 · 0 comments

Comments

@LiangKuan4451
Copy link

LiangKuan4451 commented Oct 17, 2024

This issue is unique.

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

Your idea.

Document Server version:7.1.1
Hello, I'm using vue2 + onlyoffice to make plugins.
I would like to know how to return data in callCommand
I want to return cellKeyNameData

  1. I tried callCommand(func, isClose, isCalc, callback) in the callback returns undefined,
  2. Also try to add the parameter to the callback function is undefined.
  3. I also tried to define an Asc.scope.cellKeyNameData = 1 in callCommand, change the value to 2 in the callCommand function and return Asc.scope.cellKeyNameData to callback, the result is read Asc.scope.cellKeyNameData = 1
  4. I also tried to use localStorage.setItem() in the callCommand and read it on the web page, but the storage address of localStorage.setItem() is the address of onlyofficeDocument, not the address of the page, so the data cannot be interconnected.
  5. I have also used Vuex but it doesn't, for the same reason as 4
 window.Asc.plugin.callCommand(
        function () {
           
            let cellKeyNameData = [];

            let oDocument = Api.GetDocument();

            let oTable = oDocument.GetAllTablesOnPage(0)[0];
            console.log("oTable", oTable);

            let oTableRow = oTable.GetRow(0);
            console.log("oTableRows", oTableRow);

            let oTableCell = oTable.GetCell(1, 4).GetContent().GetRange().GetText();
            console.log("oTableCell", oTableCell);

            let oTableCellIamgeTag = oTable.GetCell(0, 6).GetContent().GetElement(0).GetTag();

            for (let i = 0; i < oTable.GetRowsCount(); i++) {

                for (let j = 0; j < oTable.GetRow(i).GetCellsCount(); j++) {
                    let curRow = oTable.GetRow(i)

                    let curCell = curRow.GetCell(j)
                    let curCellRange = curCell.GetContent().GetRange();
                    let curCellRangeText = curCellRange.GetText();
                    let curCellContent = curCell.GetContent();
                   
                    if (curCellRangeText != "" && curCellRangeText.trim() !== "") {
                        cellKeyNameData.push(curCellRangeText);
                    }
                

                }

            }
           
        })
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

1 participant