Jump to content

マクロ/Calc/py018

From The Document Foundation Wiki
This page is a translated version of the page Macros/Calc/py018 and the translation is 100% complete.

説明

指定セルに数式を挿入します

Python code

def main(args=None):
    # ~ NAME_SHEET = 'Sheet1'
    document = XSCRIPTCONTEXT.getDocument()
    sheet = document.CurrentController.ActiveSheet

    # ~ 別のシートにする場合
    # ~ sheet = document.Sheets[NAME_SHEET]

    cell = sheet['B11']
    cell.Formula = '=SUM(B2:B10)'

    sheet['B11:D11'].fillAuto(1, 1)

    return