duanmu6231 2017-01-10 08:38
浏览 200

phpword生成的文件在mac和windows上有不同的lineheight

To open the docx file in mac I use the WORD Reader, where you can not edit the text, but at least open and read it. there, the content works fine. But when I open the file on Windows with Microsoft WORD, the lineheight is different and stretches the whole content.

Is it because of the Tables I am using? Do I have to define the lineheight?

  • 写回答

1条回答 默认 最新

  • doufan1899 2017-01-10 08:45
    关注

    You have to mention table columns , width , height as in different places default values are different

        $PHPWord = new PHPWord();
        // document style orientation and margin 
        $sectionStyle = array('orientation' => 'landscape', 'marginLeft'=>600, 'marginRight'=>600, 'marginTop'=>600, 'marginBottom'=>600, 'colsNum' => 2);
        $section = $PHPWord->createSection($sectionStyle);
    
        // Define table style arrays
        $styleTable = array('borderSize'=>6, 'borderColor'=>'006699', 'cellMargin'=>80, 'width'=>100);
    
        // Define font style for first row
        $fontStyle = array('bold'=>true, 'align'=>'center');
    
        // Add table style
        $PHPWord->addTableStyle('myOwnTableStyle', $styleTable);
    
        // Add table
        $table = $section->addTable('myOwnTableStyle');
    
    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)