本文整理汇总了Python中xlwt.Formula方法的典型用法代码示例。如果您正苦于以下问题:Python xlwt.Formula方法的具体用法?Python xlwt.Formula怎么用?Python xlwt.Formula使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xlwt
的用法示例。
在下文中一共展示了xlwt.Formula方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_simple_xls
# 需要导入模块: import xlwt [as 别名]
# 或者: from xlwt import Formula [as 别名]
def create_simple_xls(self, **kw):
font0 = xlwt.Font()
font0.name = 'Times New Roman'
font0.colour_index = 2
font0.bold = True
style0 = xlwt.XFStyle()
style0.font = font0
style1 = xlwt.XFStyle()
style1.num_format_str = 'D-MMM-YY'
wb = xlwt.Workbook(**kw)
ws = wb.add_sheet('A Test Sheet')
ws.write(0, 0, 'Test', style0)
ws.write(1, 0, datetime(2010, 12, 5), style1)
ws.write(2, 0, 1)
ws.write(2, 1, 1)
ws.write(2, 2, xlwt.Formula("A3+B3"))
return wb, ws
示例2: export2xls
# 需要导入模块: import xlwt [as 别名]
# 或者: from xlwt import Formula [as 别名]
def export2xls(self):
import xlwt
font0 = xlwt.Font()
font0.bold = True
font0.height = 300
print((font0.height))
style0 = xlwt.XFStyle()
style0.font = font0
style1 = xlwt.XFStyle()
style1.num_format_str = 'D-MMM-YY'
wb = xlwt.Workbook()
ws = wb.add_sheet('A Test Sheet')
ws.write(0, 0, 'Test', style0)
ws.write(2, 0, 1)
ws.write(2, 1, 1)
ws.write(2, 2, xlwt.Formula("A3+B3"))
wb.save('datasheet.xls')
os.system("gnumeric datasheet.xls")
示例3: report
# 需要导入模块: import xlwt [as 别名]
# 或者: from xlwt import Formula [as 别名]
def report(self, path, analysis, powerDeviationMatrix = True, scatterMetric=True):
self.analysis = analysis
book = xlwt.Workbook()
sh = book.add_sheet("Anonymous Report", cell_overwrite_ok=True)
sh.write(0, 0, "PCWG Tool Version Number:")
sh.write(0, 1, self.version)
sh.write(0, 2, xlwt.Formula('HYPERLINK("http://www.pcwg.org";"PCWG Website")'))
row = 1
if powerDeviationMatrix:
row = self.report_power_deviation_matrix(sh,analysis,book)
if scatterMetric:
row = self.report_scatter_metric(sh,analysis,row, analysis.turbRenormActive)
book.save(path)
示例4: _create_result_summary
# 需要导入模块: import xlwt [as 别名]
# 或者: from xlwt import Formula [as 别名]
def _create_result_summary(self):
"""Create result summary at the end of the Excel report."""
self.row_number += self.ROWS_TO_SKIP
for result_type in self.CONTENT_TO_STYLE:
self._write_to_cell(self.row_number,
self.SUMMARY_RESULT_TYPE_COLUMN,
self.CONTENT_TO_STYLE[result_type],
result_type)
result_type_count = xlwt.Formula(self.FORMULA_PATTERN %
(self.RESULT_COLUMN,
self.RESULT_COLUMN,
self.row_number,
result_type))
self._write_to_cell(self.row_number,
self.SUMMARY_RESULT_COUNTER_COLUMN,
self.DEFAULT_CELL_STYLE,
result_type_count)
self.row_number += 1
示例5: test_intersheets_ref
# 需要导入模块: import xlwt [as 别名]
# 或者: from xlwt import Formula [as 别名]
def test_intersheets_ref(self):
book = xlwt.Workbook()
sheet_a = book.add_sheet('A')
sheet_a.write(0, 0, 'A1')
sheet_a.write(0, 1, 'A2')
sheet_b = book.add_sheet('B')
sheet_b.write(0, 0, xlwt.Formula("'A'!$A$1&'A'!$A$2"))
out = BytesIO()
book.save(out)