(C) Copyright 2021 Pavel Tisnovsky
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
Contributors: Pavel Tisnovsky
link to source: https://github.com/tisnik/most-popular-python-libs/blob/master/PySimpleGUI/29_merged_cells.py
link to source in literate programming format: https://tisnik.github.io/most-popular-python-libs/PySimpleGUI/29_merged_cells.html Vytvoření sešitu se sloučenými buňkami.
import xlsxwriter
vytvoření objektu reprezentujícího celý sešit
with xlsxwriter.Workbook("example29.xlsx") as workbook:
vložení nového listu do sešitu
worksheet = workbook.add_worksheet()
formát použitý pro zvýraznění sloučené buňky
format1 = workbook.add_format(
{
"bold": 1,
"border": 1,
"align": "center",
"valign": "vcenter",
"fg_color": "#ff8080",
}
)
sloučená buňka
worksheet.merge_range("B2:D4", "Sloučená buňka", format1)
sešit bude uzavřen automaticky