将此作为
的延续Office.Js not executing in parallel, rather its doing sequential execution
我们正在使用office.js将数据写入nameRange。在后续单元格中写入相同的数据需要更多的时间,它应该花费相同的时间,因为数据是相同的。
这是相同的痕迹:
var errorObj; var DemoObj = this;
var _namedRange ;
var _data;
$(document).ready(function () {
jQuery(function ($, undefined) {
$('#out').terminal(function (command) {
if (command !== '') {
try {
var result = window.eval(command);
if (result !== undefined) {
this.echo(new String(result));
}
} catch (e) {
this.error(new String(e));
}
} else {
this.echo('');
}
}, {
greetings: 'JavaScript Interpreter',
name: 'js_demo',
height: 500,
prompt: 'js> '
});
});
//console.log("ready!");
try {
Office.initialize = function () {
// Office is ready
$(document).ready(function () {
// This is the dummy Data
var NameRange2 = 'D365_BPML_InScopeData_TB';
DemoObj.WriteExcelQPromise('Macros_EnableDisable_VB', [['cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc']]);
var Data2 = [["Yes", "BPM_2", "0"], ["Yes", "BPM_3", "0"], ["Yes", "BPM_4", "0"], ["Yes", "BPM_5", "0"], ["Yes", "BPM_6", "0"], ["Yes", "BPM_7", "0"], ["Yes", "BPM_8", "0"], ["Yes", "BPM_9", "0"], ["Yes", "BPM_11", "0"], ["Yes", "BPM_14", "0"], ["Yes", "BPM_15", "0"], ["Yes", "BPM_16", "0"], ["Yes", "BPM_17", "0"], ["Yes", "BPM_18", "0"], ["Yes", "BPM_19", "0"], ["Yes", "BPM_20", "0"], ["Yes", "BPM_21", "0"], ["Yes", "BPM_22", "0"], ["Yes", "BPM_23", "0"], ["Yes", "BPM_24", "0"], ["Yes", "BPM_25", "0"], ["Yes", "BPM_26", "0"], ["Yes", "BPM_27", "0"], ["Yes", "BPM_28", "0"], ["Yes", "BPM_29", "0"], ["Yes", "BPM_30", "0"], ["Yes", "BPM_31", "0"], ["Yes", "BPM_32", "0"], ["Yes", "BPM_33", "0"], ["Yes", "BPM_34", "0"], ["Yes", "BPM_35", "0"], ["Yes", "BPM_36", "0"], ["Yes", "BPM_37", "0"], ["Yes", "BPM_38", "0"], ["Yes", "BPM_39", "0"], ["Yes", "BPM_41", "0"], ["Yes", "BPM_42", "0"], ["Yes", "BPM_44", "0"], ["Yes", "BPM_45", "0"], ["Yes", "BPM_46", "0"], ["Yes", "BPM_47", "0"], ["Yes", "BPM_48", "0"], ["Yes", "BPM_49", "0"], ["Yes", "BPM_50", "0"], ["Yes", "BPM_51", "0"], ["Yes", "BPM_52", "0"], ["Yes", "BPM_53", "0"], ["Yes", "BPM_54", "0"], ["Yes", "BPM_55", "0"], ["Yes", "BPM_56", "0"], ["Yes", "BPM_57", "0"], ["Yes", "BPM_58", "0"], ["Yes", "BPM_59", "0"], ["Yes", "BPM_60", "0"], ["Yes", "BPM_61", "0"], ["Yes", "BPM_62", "0"], ["Yes", "BPM_63", "0"], ["Yes", "BPM_64", "0"], ["Yes", "BPM_65", "0"], ["Yes", "BPM_66", "0"], ["Yes", "BPM_67", "0"], ["Yes", "BPM_68", "0"], ["Yes", "BPM_69", "0"], ["Yes", "BPM_70", "0"], ["Yes", "BPM_71", "0"], ["Yes", "BPM_72", "0"], ["Yes", "BPM_73", "0"], ["Yes", "BPM_74", "0"], ["Yes", "BPM_75", "0"], ["Yes", "BPM_76", "0"], ["Yes", "BPM_77", "0"], ["Yes", "BPM_78", "0"], ["Yes", "BPM_80", "0"], ["Yes", "BPM_81", "0"], ["Yes", "BPM_82", "0"], ["Yes", "BPM_83", "0"], ["Yes", "BPM_84", "0"], ["Yes", "BPM_85", "0"], ["Yes", "BPM_86", "0"], ["Yes", "BPM_87", "0"], ["Yes", "BPM_88", "0"], ["Yes", "BPM_89", "0"], ["Yes", "BPM_90", "0"], ["Yes", "BPM_91", "0"], ["Yes", "BPM_92", "0"], ["Yes", "BPM_93", "0"], ["Yes", "BPM_94", "0"], ["Yes", "BPM_95", "0"], ["Yes", "BPM_96", "0"], ["Yes", "BPM_97", "0"], ["Yes", "BPM_98", "0"], ["Yes", "BPM_99", "0"], ["Yes", "BPM_100", "0"], ["Yes", "BPM_101", "0"], ["Yes", "BPM_102", "0"], ["Yes", "BPM_103", "0"], ["Yes", "BPM_104", "0"], ["Yes", "BPM_105", "0"], ["Yes", "BPM_106", "0"], ["Yes", "BPM_107", "0"], ["Yes", "BPM_108", "0"], ["Yes", "BPM_109", "0"], ["Yes", "BPM_110", "0"], ["Yes", "BPM_111", "0"], ["Yes", "BPM_112", "0"], ["Yes", "BPM_113", "0"], ["Yes", "BPM_114", "0"], ["Yes", "BPM_115", "0"], ["Yes", "BPM_116", "0"], ["Yes", "BPM_117", "0"], ["Yes", "BPM_118", "0"], ["Yes", "BPM_119", "0"], ["Yes", "BPM_120", "0"], ["Yes", "BPM_121", "0"], ["Yes", "BPM_122", "0"], ["Yes", "BPM_123", "0"], ["Yes", "BPM_124", "0"], ["Yes", "BPM_125", "0"], ["Yes", "BPM_126", "0"], ["Yes", "BPM_127", "0"], ["Yes", "BPM_128", "0"], ["Yes", "BPM_129", "0"], ["Yes", "BPM_130", "0"], ["Yes", "BPM_131", "0"], ["Yes", "BPM_132", "0"], ["Yes", "BPM_133", "0"], ["Yes", "BPM_134", "0"], ["Yes", "BPM_135", "0"], ["Yes", "BPM_136", "0"], ["Yes", "BPM_137", "0"], ["Yes", "BPM_138", "0"], ["Yes", "BPM_139", "0"], ["Yes", "BPM_140", "0"], ["Yes", "BPM_141", "0"], ["Yes", "BPM_142", "0"], ["Yes", "BPM_143", "0"], ["Yes", "BPM_144", "0"], ["Yes", "BPM_146", "0"], ["Yes", "BPM_147", "0"], ["Yes", "BPM_148", "0"], ["Yes", "BPM_149", "0"], ["Yes", "BPM_150", "0"], ["Yes", "BPM_151", "0"], ["Yes", "BPM_152", "0"], ["Yes", "BPM_153", "0"], ["Yes", "BPM_154", "0"], ["Yes", "BPM_155", "0"], ["Yes", "BPM_156", "0"], ["Yes", "BPM_157", "0"], ["Yes", "BPM_158", "0"], ["Yes", "BPM_159", "0"], ["Yes", "BPM_160", "0"], ["Yes", "BPM_161", "0"], ["Yes", "BPM_162", "0"], ["Yes", "BPM_163", "0"], ["Yes", "BPM_164", "0"], ["Yes", "BPM_165", "0"], ["Yes", "BPM_166", "0"], ["Yes", "BPM_167", "0"], ["Yes", "BPM_168", "0"], ["Yes", "BPM_169", "0"], ["Yes", "BPM_170", "0"], ["Yes", "BPM_171", "0"], ["Yes", "BPM_172", "0"], ["Yes", "BPM_173", "0"], ["Yes", "BPM_174", "0"], ["Yes", "BPM_175", "0"], ["Yes", "BPM_176", "0"], ["Yes", "BPM_177", "0"], ["Yes", "BPM_178", "0"], ["Yes", "BPM_179", "0"], ["Yes", "BPM_180", "0"], ["Yes", "BPM_181", "0"], ["Yes", "BPM_182", "0"], ["Yes", "BPM_183", "0"], ["Yes", "BPM_184", "0"], ["Yes", "BPM_185", "0"], ["Yes", "BPM_186", "0"], ["Yes", "BPM_187", "0"], ["Yes", "BPM_188", "0"], ["Yes", "BPM_189", "0"], ["Yes", "BPM_190", "0"], ["Yes", "BPM_191", "0"], ["Yes", "BPM_192", "0"], ["Yes", "BPM_193", "0"], ["Yes", "BPM_194", "0"], ["Yes", "BPM_195", "0"], ["Yes", "BPM_196", "0"], ["Yes", "BPM_197", "0"], ["Yes", "BPM_198", "0"], ["Yes", "BPM_199", "0"], ["Yes", "BPM_200", "0"], ["Yes", "BPM_201", "0"], ["Yes", "BPM_202", "0"], ["Yes", "BPM_203", "0"], ["Yes", "BPM_204", "0"], ["Yes", "BPM_206", "0"], ["Yes", "BPM_207", "0"], ["Yes", "BPM_208", "0"], ["Yes", "BPM_209", "0"], ["Yes", "BPM_210", "0"], ["Yes", "BPM_211", "0"], ["Yes", "BPM_212", "0"], ["Yes", "BPM_213", "0"], ["Yes", "BPM_214", "0"], ["Yes", "BPM_215", "0"], ["Yes", "BPM_216", "0"], ["Yes", "BPM_217", "0"], ["Yes", "BPM_218", "0"], ["Yes", "BPM_219", "0"], ["Yes", "BPM_220", "0"], ["Yes", "BPM_221", "0"], ["Yes", "BPM_222", "0"], ["Yes", "BPM_223", "0"], ["Yes", "BPM_224", "0"], ["Yes", "BPM_225", "0"], ["Yes", "BPM_226", "0"], ["Yes", "BPM_227", "0"], ["Yes", "BPM_228", "0"], ["Yes", "BPM_229", "0"], ["Yes", "BPM_230", "0"], ["Yes", "BPM_231", "0"], ["Yes", "BPM_232", "0"], ["Yes", "BPM_233", "0"], ["Yes", "BPM_234", "0"], ["Yes", "BPM_235", "0"], ["Yes", "BPM_236", "0"], ["Yes", "BPM_237", "0"], ["Yes", "BPM_238", "0"], ["Yes", "BPM_239", "0"], ["Yes", "BPM_240", "0"], ["Yes", "BPM_241", "0"], ["Yes", "BPM_242", "0"], ["Yes", "BPM_243", "0"], ["Yes", "BPM_244", "0"], ["Yes", "BPM_245", "0"], ["Yes", "BPM_246", "0"], ["Yes", "BPM_247", "0"], ["Yes", "BPM_248", "0"], ["Yes", "BPM_249", "0"], ["Yes", "BPM_250", "0"], ["Yes", "BPM_251", "0"], ["Yes", "BPM_252", "0"], ["Yes", "BPM_253", "0"], ["Yes", "BPM_254", "0"], ["Yes", "BPM_255", "0"], ["Yes", "BPM_256", "0"], ["Yes", "BPM_257", "0"], ["Yes", "BPM_258", "0"], ["Yes", "BPM_259", "0"], ["Yes", "BPM_260", "0"], ["Yes", "BPM_261", "0"], ["Yes", "BPM_262", "0"], ["Yes", "BPM_263", "0"], ["Yes", "BPM_264", "0"], ["Yes", "BPM_265", "0"], ["Yes", "BPM_266", "0"], ["Yes", "BPM_270", "0"], ["Yes", "BPM_271", "0"], ["Yes", "BPM_272", "0"], ["Yes", "BPM_273", "0"], ["Yes", "BPM_274", "0"], ["Yes", "BPM_275", "0"], ["Yes", "BPM_276", "0"], ["Yes", "BPM_277", "0"], ["Yes", "BPM_278", "0"], ["Yes", "BPM_279", "0"], ["Yes", "BPM_309", "0"], ["Yes", "BPM_310", "0"], ["Yes", "BPM_314", "0"], ["Yes", "BPM_315", "0"], ["Yes", "BPM_316", "0"], ["Yes", "BPM_317", "0"], ["Yes", "BPM_318", "0"], ["Yes", "BPM_319", "0"], ["Yes", "BPM_320", "0"], ["Yes", "BPM_321", "0"], ["Yes", "BPM_322", "0"], ["Yes", "BPM_323", "0"], ["Yes", "BPM_324", "0"], ["Yes", "BPM_325", "0"], ["Yes", "BPM_326", "0"], ["Yes", "BPM_327", "0"], ["Yes", "BPM_365", "0"], ["Yes", "BPM_366", "0"], ["Yes", "BPM_375", "0"], ["Yes", "BPM_376", "0"], ["Yes", "BPM_377", "0"], ["Yes", "BPM_378", "0"], ["Yes", "BPM_379", "0"], ["Yes", "BPM_380", "0"], ["Yes", "BPM_381", "0"], ["Yes", "BPM_382", "0"], ["Yes", "BPM_383", "0"], ["Yes", "BPM_384", "0"], ["Yes", "BPM_385", "0"], ["Yes", "BPM_386", "0"], ["Yes", "BPM_387", "0"], ["Yes", "BPM_373", "0"], ["Yes", "BPM_372", "0"], ["Yes", "BPM_371", "0"], ["Yes", "BPM_370", "0"], ["Yes", "BPM_369", "0"], ["Yes", "BPM_368", "0"], ["Yes", "BPM_374", "0"], ["Yes", "BPM_396", "0"], ["Yes", "BPM_397", "0"], ["Yes", "BPM_398", "0"], ["Yes", "BPM_399", "0"], ["Yes", "BPM_400", "0"], ["Yes", "BPM_401", "0"], ["Yes", "BPM_402", "0"], ["Yes", "BPM_403", "0"], ["Yes", "BPM_404", "0"], ["Yes", "BPM_405", "0"], ["Yes", "BPM_406", "0"], ["Yes", "BPM_407", "0"], ["Yes", "BPM_408", "0"], ["Yes", "BPM_409", "0"], ["Yes", "BPM_410", "0"], ["Yes", "BPM_411", "0"], ["Yes", "BPM_412", "0"], ["Yes", "BPM_413", "0"], ["Yes", "BPM_414", "0"], ["Yes", "BPM_415", "0"], ["Yes", "BPM_416", "0"], ["Yes", "BPM_417", "0"], ["Yes", "BPM_418", "0"], ["Yes", "BPM_419", "0"], ["Yes", "BPM_420", "0"], ["Yes", "BPM_421", "0"], ["Yes", "BPM_422", "0"], ["Yes", "BPM_423", "0"], ["Yes", "BPM_424", "0"], ["Yes", "BPM_425", "0"], ["Yes", "BPM_426", "0"], ["Yes", "BPM_427", "0"], ["Yes", "BPM_428", "0"], ["Yes", "BPM_429", "0"], ["Yes", "BPM_430", "0"], ["Yes", "BPM_431", "0"], ["Yes", "BPM_432", "0"], ["Yes", "BPM_433", "0"], ["Yes", "BPM_434", "0"], ["Yes", "BPM_435", "0"], ["Yes", "BPM_436", "0"], ["Yes", "BPM_437", "0"], ["Yes", "BPM_438", "0"], ["Yes", "BPM_439", "0"], ["Yes", "BPM_440", "0"], ["Yes", "BPM_441", "0"], ["Yes", "BPM_442", "0"], ["Yes", "BPM_443", "0"], ["Yes", "BPM_444", "0"], ["Yes", "BPM_445", "0"], ["Yes", "BPM_446", "0"], ["Yes", "BPM_447", "0"], ["Yes", "BPM_448", "0"], ["Yes", "BPM_449", "0"], ["Yes", "BPM_450", "0"], ["Yes", "BPM_451", "0"], ["Yes", "BPM_452", "0"], ["Yes", "BPM_453", "0"], ["Yes", "BPM_454", "0"], ["Yes", "BPM_455", "0"], ["Yes", "BPM_456", "0"], ["Yes", "BPM_457", "0"], ["Yes", "BPM_458", "0"], ["Yes", "BPM_459", "0"], ["Yes", "BPM_460", "0"], ["Yes", "BPM_461", "0"], ["Yes", "BPM_462", "0"], ["Yes", "BPM_463", "0"], ["Yes", "BPM_464", "0"], ["Yes", "BPM_465", "0"], ["Yes", "BPM_466", "0"], ["Yes", "BPM_467", "0"], ["Yes", "BPM_468", "0"], ["Yes", "BPM_469", "0"], ["Yes", "BPM_470", "0"], ["Yes", "BPM_471", "0"], ["Yes", "BPM_472", "0"], ["Yes", "BPM_473", "0"], ["Yes", "BPM_474", "0"], ["Yes", "BPM_475", "0"], ["Yes", "BPM_476", "0"], ["Yes", "BPM_477", "0"], ["Yes", "BPM_478", "0"], ["Yes", "BPM_479", "0"], ["Yes", "BPM_480", "0"], ["Yes", "BPM_481", "0"], ["Yes", "BPM_482", "0"], ["Yes", "BPM_483", "0"], ["Yes", "BPM_484", "0"], ["Yes", "BPM_485", "0"], ["Yes", "BPM_486", "0"], ["Yes", "BPM_487", "0"], ["Yes", "BPM_488", "0"], ["Yes", "BPM_489", "0"], ["Yes", "BPM_490", "0"], ["Yes", "BPM_491", "0"], ["Yes", "BPM_492", "0"], ["Yes", "BPM_493", "0"], ["Yes", "BPM_494", "0"], ["Yes", "BPM_495", "0"], ["Yes", "BPM_496", "0"], ["Yes", "BPM_497", "0"], ["Yes", "BPM_498", "0"], ["Yes", "BPM_499", "0"], ["Yes", "BPM_500", "0"], ["Yes", "BPM_501", "0"], ["Yes", "BPM_502", "0"], ["Yes", "BPM_503", "0"], ["Yes", "BPM_504", "0"], ["Yes", "BPM_505", "0"], ["Yes", "BPM_506", "0"], ["Yes", "BPM_507", "0"], ["Yes", "BPM_508", "0"], ["Yes", "BPM_509", "0"], ["Yes", "BPM_510", "0"], ["Yes", "BPM_511", "0"], ["Yes", "BPM_512", "0"], ["Yes", "BPM_513", "0"], ["Yes", "BPM_514", "0"], ["Yes", "BPM_515", "0"], ["Yes", "BPM_516", "0"], ["Yes", "BPM_517", "0"], ["Yes", "BPM_518", "0"], ["Yes", "BPM_519", "0"], ["Yes", "BPM_520", "0"], ["Yes", "BPM_521", "0"], ["Yes", "BPM_522", "0"], ["Yes", "BPM_523", "0"], ["Yes", "BPM_524", "0"], ["Yes", "BPM_525", "0"], ["Yes", "BPM_526", "0"], ["Yes", "BPM_527", "0"], ["Yes", "BPM_528", "0"], ["Yes", "BPM_529", "0"], ["Yes", "BPM_530", "0"], ["Yes", "BPM_531", "0"], ["Yes", "BPM_532", "0"], ["Yes", "BPM_533", "0"], ["Yes", "BPM_534", "0"], ["Yes", "BPM_535", "0"], ["Yes", "BPM_536", "0"], ["Yes", "BPM_537", "0"], ["Yes", "BPM_538", "0"], ["Yes", "BPM_539", "0"], ["Yes", "BPM_540", "0"], ["Yes", "BPM_541", "0"], ["Yes", "BPM_542", "0"], ["Yes", "BPM_543", "0"], ["Yes", "BPM_544", "0"], ["Yes", "BPM_545", "0"], ["Yes", "BPM_546", "0"], ["Yes", "BPM_547", "0"], ["Yes", "BPM_548", "0"], ["Yes", "BPM_389", "0"], ["Yes", "BPM_390", "0"], ["Yes", "BPM_391", "0"], ["Yes", "BPM_392", "0"], ["Yes", "BPM_393", "0"], ["Yes", "BPM_394", "0"], ["Yes", "BPM_395", "0"], ["Yes", "BPM_634", "0"], ["Yes", "BPM_633", "0"], ["Yes", "BPM_632", "0"], ["Yes", "BPM_631", "0"], ["Yes", "BPM_630", "0"], ["Yes", "BPM_629", "0"], ["Yes", "BPM_628", "0"], ["Yes", "BPM_627", "0"], ["Yes", "BPM_626", "0"], ["Yes", "BPM_625", "0"], ["Yes", "BPM_624", "0"], ["Yes", "BPM_623", "0"], ["Yes", "BPM_622", "0"], ["Yes", "BPM_621", "0"], ["Yes", "BPM_620", "0"], ["Yes", "BPM_619", "0"], ["Yes", "BPM_618", "0"], ["Yes", "BPM_617", "0"], ["Yes", "BPM_616", "0"], ["Yes", "BPM_615", "0"], ["Yes", "BPM_614", "0"], ["Yes", "BPM_613", "0"], ["Yes", "BPM_612", "0"], ["Yes", "BPM_611", "0"], ["Yes", "BPM_610", "0"], ["Yes", "BPM_609", "0"], ["Yes", "BPM_608", "0"], ["Yes", "BPM_607", "0"], ["Yes", "BPM_606", "0"], ["Yes", "BPM_605", "0"], ["Yes", "BPM_604", "0"], ["Yes", "BPM_589", "0"], ["Yes", "BPM_590", "0"], ["Yes", "BPM_591", "0"], ["Yes", "BPM_592", "0"], ["Yes", "BPM_593", "0"], ["Yes", "BPM_594", "0"], ["Yes", "BPM_595", "0"], ["Yes", "BPM_596", "0"], ["Yes", "BPM_597", "0"], ["Yes", "BPM_598", "0"], ["Yes", "BPM_599", "0"], ["Yes", "BPM_600", "0"], ["Yes", "BPM_601", "0"], ["Yes", "BPM_602", "0"], ["Yes", "BPM_603", "0"], ["Yes", "BPM_587", "0"], ["Yes", "BPM_586", "0"], ["Yes", "BPM_585", "0"], ["Yes", "BPM_584", "0"], ["Yes", "BPM_583", "0"], ["Yes", "BPM_582", "0"], ["Yes", "BPM_581", "0"], ["Yes", "BPM_580", "0"], ["Yes", "BPM_579", "0"], ["Yes", "BPM_578", "0"], ["Yes", "BPM_577", "0"], ["Yes", "BPM_576", "0"], ["Yes", "BPM_575", "0"], ["Yes", "BPM_574", "0"], ["Yes", "BPM_573", "0"], ["Yes", "BPM_572", "0"], ["Yes", "BPM_571", "0"], ["Yes", "BPM_570", "0"], ["Yes", "BPM_569", "0"], ["Yes", "BPM_568", "0"], ["Yes", "BPM_567", "0"], ["Yes", "BPM_566", "0"], ["Yes", "BPM_565", "0"], ["Yes", "BPM_564", "0"], ["Yes", "BPM_563", "0"], ["Yes", "BPM_562", "0"], ["Yes", "BPM_561", "0"], ["Yes", "BPM_560", "0"], ["Yes", "BPM_559", "0"], ["Yes", "BPM_558", "0"], ["Yes", "BPM_716", "0"], ["Yes", "BPM_715", "0"], ["Yes", "BPM_714", "0"], ["Yes", "BPM_712", "0"], ["Yes", "BPM_711", "0"], ["Yes", "BPM_704", "0"], ["Yes", "BPM_703", "0"], ["Yes", "BPM_702", "0"], ["Yes", "BPM_701", "0"], ["Yes", "BPM_700", "0"], ["Yes", "BPM_699", "0"], ["Yes", "BPM_698", "0"], ["Yes", "BPM_697", "0"], ["Yes", "BPM_696", "0"], ["Yes", "BPM_695", "0"], ["Yes", "BPM_694", "0"], ["Yes", "BPM_693", "0"], ["Yes", "BPM_692", "0"], ["Yes", "BPM_691", "0"], ["Yes", "BPM_690", "0"], ["Yes", "BPM_689", "0"], ["Yes", "BPM_688", "0"], ["Yes", "BPM_687", "0"], ["Yes", "BPM_686", "0"], ["Yes", "BPM_685", "0"], ["Yes", "BPM_684", "0"], ["Yes", "BPM_555", "0"], ["Yes", "BPM_554", "0"], ["Yes", "BPM_553", "0"], ["Yes", "BPM_552", "0"], ["Yes", "BPM_551", "0"], ["Yes", "BPM_550", "0"], ["Yes", "BPM_679", "0"], ["Yes", "BPM_680", "0"], ["Yes", "BPM_682", "0"], ["Yes", "BPM_683", "0"], ["Yes", "BPM_725", "0"], ["Yes", "BPM_760", "0"], ["Yes", "BPM_756", "0"], ["Yes", "BPM_755", "0"], ["Yes", "BPM_754", "0"], ["Yes", "BPM_753", "0"], ["Yes", "BPM_752", "0"], ["Yes", "BPM_751", "0"], ["Yes", "BPM_750", "0"], ["Yes", "BPM_657", "0"], ["Yes", "BPM_656", "0"], ["Yes", "BPM_655", "0"], ["Yes", "BPM_654", "0"], ["Yes", "BPM_648", "0"], ["Yes", "BPM_647", "0"], ["Yes", "BPM_646", "0"], ["Yes", "BPM_645", "0"], ["Yes", "BPM_644", "0"], ["Yes", "BPM_642", "0"], ["Yes", "BPM_641", "0"], ["Yes", "BPM_640", "0"], ["Yes", "BPM_639", "0"], ["Yes", "BPM_638", "0"], ["Yes", "BPM_637", "0"], ["Yes", "BPM_720", "0"], ["Yes", "BPM_721", "0"], ["Yes", "BPM_749", "0"], ["Yes", "BPM_731", "0"], ["Yes", "BPM_732", "0"], ["Yes", "BPM_733", "0"], ["Yes", "BPM_734", "0"], ["Yes", "BPM_735", "0"], ["Yes", "BPM_737", "0"], ["Yes", "BPM_738", "0"], ["Yes", "BPM_739", "0"], ["Yes", "BPM_740", "0"], ["Yes", "BPM_741", "0"], ["Yes", "BPM_742", "0"], ["Yes", "BPM_743", "0"], ["Yes", "BPM_744", "0"], ["Yes", "BPM_745", "0"], ["Yes", "BPM_746", "0"], ["Yes", "BPM_747", "0"], ["Yes", "BPM_748", "0"], ["Yes", "BPM_659", "0"], ["Yes", "BPM_660", "0"], ["Yes", "BPM_661", "0"], ["Yes", "BPM_662", "0"], ["Yes", "BPM_663", "0"], ["Yes", "BPM_664", "0"], ["Yes", "BPM_665", "0"], ["Yes", "BPM_666", "0"], ["Yes", "BPM_667", "0"], ["Yes", "BPM_668", "0"], ["Yes", "BPM_669", "0"], ["Yes", "BPM_763", "0"], ["Yes", "BPM_764", "0"], ["Yes", "BPM_765", "0"]]
DemoObj.WriteExcelQPromise('D365_BPML_InScopeData_TB', Data2);
DemoObj.WriteExcelQPromise('D365_BPML_InScopeData_TB2', Data2);
DemoObj.WriteExcelQPromise('D365_BPML_InScopeData_TB3', Data2);
DemoObj.WriteExcelQPromise('D365_BPML_InScopeData_TB4', Data2);
DemoObj.WriteExcelQPromise('Table1', Data2);
DemoObj.WriteExcelQPromise('Table2', Data2);
DemoObj.WriteExcelQPromise('Table3', Data2);
DemoObj.WriteExcelQPromise('Table4', Data2);
// DemoObj.WriteExcelQPromise('Macros_EnableDisable_VB', [['vvvvvvvvvvvvvvvvvvvvv']]);
});
};
}
catch (e) {
$("#TraceArea").append('An error has occurred: ' + e.message)
}
});
function WriteExcelQPromise(namedRange, data) {
$("#TraceArea").append("\n In WriteExcelTableQPromise method " + namedRange + " " + Date() + " ");
var startTime = Date.now();
var bindingType = DemoObj.GetBindingType(namedRange);
Office.select('bindings#' + namedRange, function (callback) {
if (callback.status === Office.AsyncResultStatus.Failed) {
$("#TraceArea").append('status');
Office.context.document.bindings.addFromNamedItemAsync(namedRange, bindingType, {
id: namedRange,
asyncContext: data,
coercionType: bindingType
}, function (result) {
if (result.status == Office.AsyncResultStatus.Succeeded) {
var id = result.value.id;
Office.select("bindings#" + id, function () {
$("#TraceArea").append("\nFailed");
}).setDataAsync(result.asyncContext, {
coercionType: result.value.type
}, function (asyncResult) {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
$("#TraceArea").append("\ncompleted In WriteExcelQPromise method " + namedRange + " time elapsed -" + ((Date.now() - startTime) / 1000));
}
else {
$("#TraceArea").append("\nIn WriteExcelQPromiseFail1 method " + asyncResult.error.message + " " + Date() + " ", asyncResult);
}
});
}
else {
errorObj = result;
$("#TraceArea").append("\nIn WriteExcelQPromiseFail2 method " + errorObj.error.message + " " + Date() + " ", result);
}
});
}
}).setDataAsync(data, {
coercionType: Office.BindingType.Matrix
}, function (asyncResult) {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
$("#TraceArea").append("\ncompleted In WriteExcelQPromise method " + namedRange + " time elapsed -" + ((Date.now() - startTime) / 1000) + " : " + Date());
}
else {
$("#TraceArea").append("\nIn WriteExcelQPromiseFail3 method " + asyncResult.error.message + Date() + " ", asyncResult);
}
});
}
function GetBindingType(namedRange) {
var type = namedRange ? namedRange.substring(namedRange.length - 2) : "MX";
var bindingType;
switch (type) {
case 'MX':
bindingType = Office.BindingType.Matrix;
break;
case 'TX':
bindingType = Office.BindingType.Text;
break;
case 'TB':
bindingType = Office.BindingType.Table;
break;
default:
bindingType = Office.BindingType.Matrix;
}
return bindingType;
};
function WriteExcelTableQPromise (namedRange, data) {
$("#TraceArea").append("\nIn WriteExcelTableQPromise method " + namedRange + " " + Date() + " ");
var startTime = Date.now();
//var defQWrite = Q.defer();
var bindingType = DemoObj.GetBindingType(namedRange);
if (bindingType === Office.BindingType.Table) {
Office.context.document.bindings.addFromNamedItemAsync(namedRange, bindingType, {
coercionType: bindingType
}, function (result) {
if (result.status == Office.AsyncResultStatus.Succeeded) {
var id = result.value.id;
result.value.deleteAllDataValuesAsync(function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
if (data.length > 0) {
result.value.addRowsAsync(data, null, function (callbackresult) {
if (callbackresult.status == Office.AsyncResultStatus.Succeeded) {
$("#TraceArea").append("\ncompleted In WriteExcelQPromise method " + namedRange + " time elapsed -" + ((Date.now() - startTime) / 1000));
// defQWrite.resolve(namedRange);
}
else {
$("#TraceArea").append("\nIn WriteExcelTableQPromiseFail1 method " + namedRange + Date() + " ", asyncResult);
// defQWrite.reject(' Error :' + callbackresult.error.message);
}
});
}
else {
$("#TraceArea").append("\ncompleted In WriteExcelQPromise method " + namedRange + " time elapsed -" + ((Date.now() - startTime) / 1000));
// defQWrite.resolve(namedRange);
}
}
else {
$("#TraceArea").append("\nIn WriteExcelTableQPromiseFail2 method " + namedRange + Date() + " ", asyncResult);
// defQWrite.reject(' Error: ' + asyncResult.error.message);
}
});
}
else {
$("#TraceArea").append("\nIn WriteExcelTableQPromiseFail3 method " + namedRange + Date() + " ");
// defQWrite.reject(' Error: ' + result.error.message);
}
});
// return defQWrite.promise;
}
else {
DemoObj.WriteExcelQPromise(namedRange, data).then(function (o) {
// defQWrite.resolve(namedRange);
}).fail(function (o) { defQWrite.reject(o); });
}
// return defQWrite.promise;
};
function toExcelFormat (inputData) {
var d365formula = D365FormulaeManager.V1.D365Formulae.D365Formulaes;
var inscopeData = new Office.TableData();
inscopeData.rows = [];
inscopeData.rows.pop();
if (inputData) {
var length = inputData.length;
var bpmScenariosData = [];
var counter = BaseConstants.Constants.Counter;
var counter2 = BaseConstants.Constants.SecondCounter;
var isFormula = d365formula.BPMScenariosInScope;
for (var i = 0; i < length; i++) {
bpmScenariosData = [];
bpmScenariosData.push(isFormula.replaceAll(counter, (this.startRow + i)).replaceAll(counter2, (this.startRow + i + 1)));
bpmScenariosData.push(inputData[i].UMS);
inscopeData.rows.push(bpmScenariosData);
}
}`enter code here`
if (inscopeData.rows.length < this.MaxRows) {
var itemsToAdd = this.MaxRows - inscopeData.rows.length;
var item = [];
for (var i = 0; i < itemsToAdd; i++) {
item = [];
item.push('');
item.push('');
inscopeData.rows.push(item);
}
}
else if (inscopeData.rows.length > this.MaxRows) {`enter code here`
inscopeData.rows.length = this.MaxRows;
}
return inscopeData;
};