首页 \ 问答 \ Apache POI和SUMPRODUCT公式评估(Apache POI and SUMPRODUCT formula evaluation)

Apache POI和SUMPRODUCT公式评估(Apache POI and SUMPRODUCT formula evaluation)

我有一个模板XLS文件,我使用Apache POI加载并在其中写入大量数据,然后将其另存为另一个文件。 我的XLS文件中有这样的公式:

=SUMPRODUCT((DS!B:B="IN_THIS_ONLY")*(DS!D:D="New trade"))

也试过了

=SUMPRODUCT(0+(DS!B:B="IN_THIS_ONLY"),0+(DS!D:D="New trade"))

如果我按下Excel中的单元格上的Enter,这些评估会正确。 但是,只是打电话

HSSFFormulaEvaluator.evaluateAllFormulaCells(workbook);

似乎没有评估它们,也没有按下Excel中的“现在计算”按钮 - 所以我想这是一个特殊的公式或函数。

另一个更传统的COUNTIFSUMIF工作正常,但是这些不允许指定多个条件。

POI不支持数组公式。

有什么办法可以使这些工作。 我正在使用POI 3.7版。


I have a template XLS file that I load with Apache POI and write loads of data in it, then save it as another file. I have formulas in my XLS file like this:

=SUMPRODUCT((DS!B:B="IN_THIS_ONLY")*(DS!D:D="New trade"))

also tried

=SUMPRODUCT(0+(DS!B:B="IN_THIS_ONLY"),0+(DS!D:D="New trade"))

these evaluate correctly if I press Enter on the cell in Excel. However, simply calling

HSSFFormulaEvaluator.evaluateAllFormulaCells(workbook);

does not seem to evaluate them, neither does pressing on the "Calculate now" button in Excel - so I guess this is a special formula or function.

The other, more conventional COUNTIFs and SUMIFs work fine, however these do not allow multiple conditions to be specified.

POI does not support array formulas.

Is there any way to make these work. I'm using POI version 3.7.


原文:https://stackoverflow.com/questions/5832695
更新时间:2023-02-25 20:02

最满意答案

以下方法并不完全符合您的要求。 但是,基本意图是根据添加到应用程序的新组件,在未改变渲染视图的情况下动态加载新组件。 关于角度网站上有一篇很好的文章:

https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html

就这样,它对于组件的新声明将保持相同,只需要在entryComponent中为在声明新组件的同一模块文件中添加的每个新组件创建一个额外的条目:

entryComponents: [ HeroJobAdComponent, HeroProfileComponent ],


The below approach doesn't work exactly as per your requirement. But, the basic intend is to load a new component dynamically in future without changing the rendering view, based on new component added to the application. There is a nice article on angular website on this:

https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html

Just that, it will remain same for the new declaration of component, just you need to make an additional entry in entryComponent for each new component added in the same module file where the new component is declared:

entryComponents: [ HeroJobAdComponent, HeroProfileComponent ],

相关问答

更多
  • 首先,你不需要创建一个全新的仓库来重新组织你的项目。 其次,如果可以,请在您的解决方案仓库中查找完整的解决方案仓库,然后创建并svn add 分支,标签,中继文件夹。 不要提交它们; 你会svn move每隔一个文件夹(项目文件夹)移动到trunk中 ,然后一次完成所有事务。 为了说明,我创建了一个SampleRepo ,将其检出,然后svn add ed和svn commit了几个占位符项目文件夹: 然后,我在repo checkout的根目录下创建了分支 , 标签和中继文件夹,然后svn add使用To ...
  • 如你所说,你需要编写一个递归方法。 我试着写一个,请测试下面的代码: public class TestTree extends JFrame { JTree tree; DefaultTreeModel treeModel; public TestTree() { super("Tree Test Example"); setSize(400, 300); setDefaultCloseOperation(EXIT_ON_CLOS ...
  • 以下方法并不完全符合您的要求。 但是,基本意图是根据添加到应用程序的新组件,在未改变渲染视图的情况下动态加载新组件。 关于角度网站上有一篇很好的文章: https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html 就这样,它对于组件的新声明将保持相同,只需要在entryComponent中为在声明新组件的同一模块文件中添加的每个新组件创建一个额外的条目: entryComponents: [ HeroJobAdCompone ...
  • 阅读以下部分的ember-cli指南。 复制在此供参考: // ember-cli-build.js var app = new EmberApp({ outputPaths: { app: { html: 'index.html', css: { 'app': '/assets/application-name.css' }, js: '/assets/application-name.js' }, vendor: ...
  • 如果要在计算机上全局安装这些模块,请添加-g : npm install -g babel-preset-es2015 babel-preset-react 否则,我想你在本地安装它。 确保您在root用户中使用package.json来启动该命令。 遵循包规则 。 这是一个例子。 您可以尝试在package-json-validator.com上验证您的package.json If you want to install globally on your computer those modules, ...
  • 一个简短的回答从评论中扩展出来:这是Cython支持的功能 。 它允许您定义编译时常量 DEF a = 5 并有条件地包含取决于这些常量的代码: IF a==5: cdef f(): return 1 ELSE: cdef f(): return 2 它还定义了一些有用的常量: UNAME_SYSNAME , UNAME_SYSNAME允许您在Windows,OS X和Linux之间进行选择。 这些表达式在Cython在.pyx文件上运行时进行评估 - 因 ...
  • iOS通常使用惯用语来确定作为运行时事物的设备类型。 您可以为两者之间的不同构建编写自己的目标。 由于AppleTV没有默认目标,因为没有官方SDK,您可能需要自己推出。 XCode 4附带的LLVM / Clang功能之一是运行时检查框架。 不确定UIKit是否包含在AppleTV中,但是经过大量修改或者是否丢失了。 iOS usually uses idioms to determine device types which is a runtime thing. You can write your ...
  • 是的,有,但这并不容易,可能不值得你的麻烦。 一种方法是创建自己的BuildProvider并在配置文件中用它替换默认的System.Web.Compilation.PageBuildProvider:
  • 预编译工具目前仅在code.google.com下载中提供 ; 但是,在我的待办事项列表中添加第二个NuGet包(protobuf-net.tools或类似)与命令行实用程序。 The precompile tool is currently only available in the code.google.com download; however, adding a second NuGet package (protobuf-net.tools, or similar) with the comma ...
  • 有问题的批处理代码递归搜索*EG_*.exe并更新所有找到的文件,这些文件导致一次又一次地处理同一文件,因为通配符模式匹配的文件列表在处理与模式匹配的每个文件时发生变化。 解决方案是使用命令DIR首先获取与通配符模式匹配的所有文件的完整列表,然后在下一步中处理此列表。 在这种情况下,找到的文件更新并不重要,因为在处理文件列表之前, DIR命令已经完全输出了文件列表。 pushd "%~dp0" for /F "delims=" %%I in ('dir /A-D /B /ON /S "*EG_*.exe"' ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)