Forum


Replies: 1   Views: 1345
Listoverrideoptions start is not working?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by neukanri  · 22-10-2020 - 05:30

 

I am creating a list using listOverrideOptions.

The "type" is changed, but the "start" is not changed and the previous state is inherited.

I want you to start from 2 at first, and start from 1 on the override side.

// CUSTOM LIST
$fullNumOpt = array(
    'type' => 'decimalFullWidth',
    'format' => '%1',
    'left' => 400,
    'hanging'=> 280,
    'align' => 'left'
);
$kanNumOpt = array(
    'type' => 'japaneseCounting',
    'format' => '%1',
    'left' => 800,
    'hanging'=> 380,
    'align' => 'left'
);
$irohaOpt = array(
    'type' => 'irohaFullWidth',
    'format' => '%1',
    'left' => 1200,
    'hanging' => 380,
    'align' => 'left'
);


$joOpt = array();
$joOpt[0] = $fullNumOpt;
$joOpt[0]['format'] = '第%1æ¡';
$joOpt[0]['left'] = 440;
$joOpt[0]['hanging'] = 500;

$joOpt[1] = $fullNumOpt;
$joOpt[1]['format'] = '%2';
$joOpt[1]['start'] = 2;
$joOpt[1]['left'] = 440;
$joOpt[1]['hanging'] = 420;

$joOpt[2] = $kanNumOpt;
$joOpt[2]['format'] = '%3';

$joOpt[3] = $irohaOpt;
$joOpt[3]['format'] = '%4';

// override
$kanOpt = array();
$kanOpt[0] = $fullNumOpt;
$kanOpt[0]['format'] = '第%1æ¡';
$kanOpt[0]['left'] = 440;
$kanOpt[0]['hanging'] = 500;
$kanOpt[0]['start'] = 1;
$kanOpt[1] = $kanNumOpt;
$kanOpt[1]['start'] = 1;
$kanOpt[1]['format'] = '%2.';

$kanListStyle = array();
$kanListStyle[0] = array(
    'listOptions' => $kanOpt,
    'name' => 'kanList'
);

$docx->createListStyle('joList', $joOpt, $kanListStyle);

$tidy_html = createTidyHTML($html);

$docx->replaceVariableByHTML('EXTERNAL', 'block', $tidy_html,
    array(
        'customListStyles' => true,
        'strictWordStyles' => true,
        'useHTMLExtended' => true,
        'parseDivsAsPs' => true,
        'wordStyles' => array(
            '.joList' => 'joList',
            '.kanList' => 'kanList',
        )
    )
);