使用Python.NET计算Excel 2016的MINIFS和MAXIFS函数
Contents
[
Hide
]
可能的使用场景
Microsoft Excel 2016支持MINIFS和MAXIFS函数。这些函数在Excel 2013或更早版本中不支持。Aspose.Cells也支持这些函数的计算。下图显示了这些函数的用法。请阅读图片中的红色注释以理解这些函数的工作机制。
计算Excel 2016的MINIFS和MAXIFS函数
以下示例代码加载样例Excel文件,调用workbook.calculate_formula()方法,通过Aspose.Cells进行公式计算,然后将结果保存在输出PDF。
import os
from aspose.cells import Workbook, PdfSaveOptions
# For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
current_dir = os.path.dirname(os.path.abspath(__file__))
source_dir = os.path.join(current_dir, "data")
output_dir = os.path.join(current_dir, "output")
# Load your source workbook containing MINIFS and MAXIFS functions
workbook = Workbook(os.path.join(source_dir, "sampleMINIFSAndMAXIFS.xlsx"))
# Perform Aspose.Cells formula calculation
workbook.calculate_formula()
# Save the calculations result in pdf format
options = PdfSaveOptions()
options.one_page_per_sheet = True
if not os.path.exists(output_dir):
os.makedirs(output_dir)
workbook.save(os.path.join(output_dir, "outputMINIFSAndMAXIFS.pdf"), options)