weixin_33743880 2018-01-19 20:19 采纳率: 0%
浏览 3

OfficeJS缓存

I'm really curious if someone can better explain the internal workings of excel's addin caching of javascript functions? I'm running a flask app on my own internal website behind a SSL cert. My addin pulls in this functionfile.html, and makes an ajax call back to mysite:

<script>
// After the Office library builds, it will look for Office.initialize
// which must be passed a function.  It doesnt have to do anything though.
    Office.initialize = function (reason){
        $(document).ready(function(){
            registerBindings();
        });
    }


    function getData(){
        return Excel.run( function (context) {

            // request bindings
            var state_nbr = context.workbook.bindings.getItem("state_nbr").getRange().load("values");
            // and the rest for the ajax call

            return context.sync().then( function () {
                $.ajax({
                  type: "GET",
                  url: "https://example.com/excel/function",
                  data: {
                      "state_nbr": state_nbr.values[0][0]
                  }
              }).done( function (data){
                      context.workbook.bindings.getItem("test").getRange().values = [["done"]];
                      return context.sync();
              }).fail( function (result){
                      context.workbook.bindings.getItem("test").getRange().values = [["fail"]];
                      return context.sync();
              });
          });
      });
   }
</script>

When I click my button, I can see the request with the right payload going to example.com/excel/function, which is a flask route that pumps out a bunch of CLI junk (hundreds of logging commands).

What gets weird though, is that after that first click every time I click the button I don't get any new ajax requests, I only get a request for the functionfile.html. But SheetA1 still pops up "done".

I thought this was just storing the results in cache, but even with flask running in debug mode, if I change functionfile.html, say [["done"]] to [["finished"]], no new ajax call is detected in my logs. BUT THE SHEET UPDATES?!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目
    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
    • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
    • ¥15 linux驱动,linux应用,多线程