excel - 格式化程序参数作为 null 传递

标签 excel sapui5 formatter

我正在尝试将表格数据导出到 Excel 工作表。没有格式化程序一切正常。但在将表格转换为 Excel 之前,我必须先格式化一些单元格。我正在调试代码。格式化程序函数的参数作为空值传递。这是我的代码:

var oExport = new sap.ui.core.util.Export({

  exportType: new sap.ui.core.util.ExportTypeCSV({
    separatorChar: ";"
  }),

  models: this.getView().getModel(),

  rows: {
    path: "/FaaliyetServisiSet"
  },

  columns: [{
      name: "Kişi",
      template: {
        content: "{Klnad}"
      }
    }, {
      name: "Faaliyet",
      template: {
        content: "{Falyt}"
      }
    }, {
      name: "Süre",
      template: {
        content: {
          parts: ["Sure"],
          formatter: function(oValue) { // oValue is null that's the problem !!!!!!!  
            oValue = oValue + 2;
            return oValue;
          }
        }

      }
    }, {
      name: "Proje",
      template: {
        content: "{Proje}"
      }
    },

  ]
});

最佳答案

您应该为部分使用对象数组而不是字符串

parts: [
    { path: "Sure" }
]

https://openui5.hana.ondemand.com/#docs/guide/07e4b920f5734fd78fdaa236f26236d8.html

关于excel - 格式化程序参数作为 null 传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30260117/

相关文章:

python - 值错误 : I/O operation on closed file even after giving second arg for open()

sapui5 - UI5 有时会抛出错误 : Control with ID . .. 无法找到 - EventProvider sap.m.routing.Target

json - 使用模型名称将 JSON 绑定(bind)到 View (SAPUI5)

java - 使用Java Formatter类时,为什么构造函数会创建一个txt文件,但不写入它?

java - 格式化 Java 日志记录

javascript - 带有单选按钮的 html 表复制粘贴到 xls 中

excel - 合并唯一列上的值

excel - 使用宏打印 Excel 文件。但如果某一行的值为 0,则跳过它

javascript - SAPUI5使sap.m.Panel整行可点击

ios - 找出系统默认的单位类型(升/加仑)