【发布时间】:2018-09-05 20:52:34
【问题描述】:
我的 Yii2 和 Microsoft word 2016 使用 PhpOffice\PhpWord。
值数据类型decimal(15,2) 当我从我的项目字段值十进制显示10000.00 下载microsoftwordfile.docx 时,但我需要10,000.00
如何配置/编码它们以显示10,000.00
这里myController.php
public function actionWord($id)
{
Settings::setTempDir(Yii::getAlias('@webroot').'/temp/');
$templateProcessor = new TemplateProcessor(Yii::getAlias('@webroot').'/path/to/microsoftwordfile.docx');
$model = Dataexample::findOne($id);
$templateProcessor->setValue(
[
'amount',
],
[
$model->amount,
]);
$templateProcessor->saveAs(Yii::getAlias('@webroot').'/path/to/microsoftwordfile.docx');
echo Html::a('download', Url::to(Yii::getAlias('@web').'/path/to/microsoftwordfile.docx'), ['class' => 'btn btn-danger']);
}
【问题讨论】: