ONLYOFFICE / sdkjs-plugins

The add-ons for ONLYOFFICE Document Server and ONLYOFFICE Desktop Editors.
https://www.onlyoffice.com
Apache License 2.0
136 stars 134 forks source link

How insert content control to excel cell? #44

Closed zopxy closed 5 years ago

zopxy commented 5 years ago
var _script = "";
_script += 'var oWorksheet = Api.GetActiveSheet();\r\n';
_script += 'var oParagraph = Api.CreateParagraph();\r\n';
_script += 'var oRun = oParagraph.AddText(\'' + Label + '\');\r\n';
_script += 'var oCell = oWorksheet.GetActiveCell();\r\n';
_script += 'var row = oCell.GetRow();\r\n';
_script += 'var col = oCell.GetCol();\r\n';
_script += 'oWorksheet.GetRangeByNumber(row,col).SetFillColor(Api.CreateColorFromRGB(255,224,204));\r\n';
_script += 'oWorksheet.GetRangeByNumber(row, col).InsertContent([oParagraph], true);\r\n';

var _scriptObject = {
    "Props" : {
        "Tag"        : Tag,
        "Lock"       : 0,
        "InternalId" : InternalId
    },
    "Script" : _script
};

window.Asc.plugin.executeMethod("InsertAndReplaceContentControls", [[_scriptObject]]);

it's not work

flaminestone commented 5 years ago

Hello @bopro. There is no way to do this. You can't add content control in spreadsheet