在 docx 文件中创建表


create table in docx file

我在docx或doc文件中写了三天的彩色表格标题或表格的彩色背景,但我找不到合适的解决方案。我正在使用 php 库 phpdocx 来生成 docx 文件。

任何人都可以告诉我我在这里做错了什么吗?

这是我正在尝试的代码:

require_once '../../classes/CreateDocx.inc';

    $docx = new CreateDocx();
    //Tables
    $valuesTable = array(
    array(
            'head 1','head 2','head 3','head 4','head 5','head 6','head 7','head 8','head 9','head 10'
        ),
        array(
            11,12,13,14,15,16,17,18,19,20
        ),
        array(
            21,22,23,24,25,26,27,28,29,30
        ),
    );
    $paramsTable = array(
        'border' => 'single',
        'border_sz' => 20,
        'TBLSTYLEval' => 'MediumGrid3-accent5PHPDOCX'
    );
    //$paramsTable = array('TBLSTYLEval' => 'MediumGrid3-accent5PHPDOCX');
    $docx->addTable($valuesTable, $paramsTable);
    ##########################
    $docx->createDocx('example_image');

它生成简单的表格表,没有任何格式,如边框,颜色等。

多谢。

任何帮助将不胜感激。

使用.Net我的朋友:) - 有Open XML SDK,它非常强大。