Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python docxtpl-如何更改列的大小?_Python_Python 3.x_Ms Word_Docx - Fatal编程技术网

Python docxtpl-如何更改列的大小?

Python docxtpl-如何更改列的大小?,python,python-3.x,ms-word,docx,Python,Python 3.x,Ms Word,Docx,我正在使用docxtpl生成word文档。我正在向Word文档插入多个表,并想知道如何更改代码中特定列的大小 以下是my template.docx中的表格: 该表在报告中的外观如图所示: 下面是我如何将表插入docx的概览: ## Create panda data frame from the dict df_bauwerke = pd.DataFrame.from_dict(outDict['Bauwerke']['Schlüsselbauwerke'], orient

我正在使用docxtpl生成word文档。我正在向Word文档插入多个表,并想知道如何更改代码中特定列的大小

以下是my template.docx中的表格:

该表在报告中的外观如图所示:

下面是我如何将表插入docx的概览:

    ## Create panda data frame from the dict
    df_bauwerke = pd.DataFrame.from_dict(outDict['Bauwerke']['Schlüsselbauwerke'], orient='index')
    

    ## Convert panda df to DocxTemplate table format
    table_bauwerke = {
        "bauwerke_col_labels": list(df_bauwerke.columns.values),
        "bauwerke_tbl_contents": [{"cols": rows} for rows in df_bauwerke.values.tolist()]}

    context_to_load.update(table_bauwerke)
我想更改“Jahr”和“Name”列的宽度(Name更大,Jahr更窄),其余的保持不变。我能在我的剧本中影响它吗