ver Jan2nd

calc metrics are prapared by and large
This commit is contained in:
David Chang
2024-01-02 21:03:57 +08:00
parent d41c674a91
commit 6e6ef03bc9
9 changed files with 208 additions and 10 deletions

View File

@@ -110,7 +110,7 @@ def check_xlsx_freeze(result: str, rules: Dict[str, str]) -> float:
worksheet: Worksheet = openpyxl.load_workbook(filename=result).active
return float(worksheet.freeze_panes == rules["position"])
def check_zoom(result: str, rules: Dict[str, Union[str, Number]]) -> float:
def check_xlsx_zoom(result: str, rules: Dict[str, Union[str, Number]]) -> float:
worksheet = openpyxl.load_workbook(filename=result).active
zoom_scale: Number = worksheet.sheet_view.zoomScale or 100.
return float( getattr(operator, rules["relation"])( zoom_scale
@@ -160,21 +160,31 @@ if __name__ == '__main__':
#path1 = "../../任务数据/LibreOffice Calc/Represent_in_millions_billions_gold.xlsx"
#path2 = "../../任务数据/LibreOffice Calc/Represent_in_millions_billions_gold3.xlsx"
#path1 = "../../任务数据/LibreOffice Calc/Set_Decimal_Separator_Dot.xlsx"
#path2 = "../../任务数据/LibreOffice Calc/Set_Decimal_Separator_Dot_gold.xlsx"
#workbook1: Workbook = openpyxl.load_workbook(filename=path1)
#worksheet1: Worksheet = workbook1.active
#
#import itertools
#for col, r in itertools.product( ['A', 'B', 'C']
#, range(1, 9)
#for col, r in itertools.product( ['A', 'B']
#, range(1, 20)
#):
#position: str = "{:}{:d}".format(col, r)
#print(worksheet1[position])
#print(worksheet1[position].value)
#print(worksheet1[position].number_format)
#workbook2: Workbook = openpyxl.load_workbook(filename=path2)
#worksheet2: Worksheet = workbook2.active
#for col, r in itertools.product( ['A', 'B']
#, range(1, 20)
#):
#position: str = "{:}{:d}".format(col, r)
#print(worksheet2[position])
#print(worksheet2[position].value)
#print(worksheet2[position].number_format)
#print(compare_table(path1, path2, features=["number_format"]))
path1 = "../../任务数据/LibreOffice Calc/Zoom_Out_Oversized_Cells_gold.xlsx"
path2 = "../../任务数据/LibreOffice Calc/Zoom_Out_Oversized_Cells.xlsx"
#path1 = "../../任务数据/LibreOffice Calc/Zoom_Out_Oversized_Cells_gold.xlsx"
#path2 = "../../任务数据/LibreOffice Calc/Zoom_Out_Oversized_Cells.xlsx"
#workbook1: Workbook = openpyxl.load_workbook(filename=path1)
#worksheet1: Worksheet = workbook1.active
#print(worksheet1.sheet_view.zoomScale)
@@ -187,5 +197,9 @@ if __name__ == '__main__':
#):
#path = os.path.join("../../任务数据/LibreOffice Calc/", wb)
#print(wb, openpyxl.load_workbook(filename=path).active.sheet_view.zoomScale)
print(check_zoom(path1, {"relation": "lt", "ref_value": 100}))
print(check_zoom(path2, {"relation": "lt", "ref_value": 100}))
#print(check_zoom(path1, {"relation": "lt", "ref_value": 100}))
#print(check_zoom(path2, {"relation": "lt", "ref_value": 100}))
path1 = "../../任务数据/LibreOffice Calc/Padding_Decimals_In_Formular_gold.xlsx"
data_frame: pd.DataFrame = pd.read_excel(path1)
print(data_frame)