phpword:更改图表的字体样式的数据和标题

发布于 2025-02-11 16:54:08 字数 770 浏览 0 评论 0原文

我们的团队正在使用phpword库( https://github.com/phpoffice/phpoffice/phpword )。我们使用一个模板,其中插入正确的元素,其中包括饼图,数据和标题需要具有特定的字体样式。但是,似乎在

public function createPieChart($cats,$values,$title){
    $chart = new Chart('pie',$cats,$values);
    $chart->getStyle()
        ->setTitle($title)
        ->setShowLegend(true)
        ->setLegendPosition('b')
        ->setColors($this->colors)
        ->setWidth(Converter::inchToEmu(3))
        ->setHeight(Converter::inchToEmu(3))
        ->setDataLabelOptions([
        'showCatName'=>false,
        'showVal'=>false,
        'showPercent'=>true
        ]);
    return $chart;
}

Our team is using the PhpWord library (https://github.com/PHPOffice/PhpWord). We use a template in which we insert the correct elements, among which are pie charts, and the data and title need to have a specific font style. However, it seems that a way to change the style of the title and data, or to write them using a preset style, is not documented in https://phpword.readthedocs.io/en/latest/styles.html#chart. Is there a way to change the font style of a chart's data and title? Thank you.

public function createPieChart($cats,$values,$title){
    $chart = new Chart('pie',$cats,$values);
    $chart->getStyle()
        ->setTitle($title)
        ->setShowLegend(true)
        ->setLegendPosition('b')
        ->setColors($this->colors)
        ->setWidth(Converter::inchToEmu(3))
        ->setHeight(Converter::inchToEmu(3))
        ->setDataLabelOptions([
        'showCatName'=>false,
        'showVal'=>false,
        'showPercent'=>true
        ]);
    return $chart;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文