简体   繁体   English

phpspreadsheet 保存文件时特定sheet的形状和图像消失的问题

[英]phpspreadsheet The problem that the shape and image of a specific sheet disappear when saving a file

<?php

require __DIR__ . '/vendor/autoload.php';

$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$spreadsheet = $reader->load($origin_file);

$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
$writer->setPreCalculateFormulas(false);
$writer->setOffice2003Compatibility(true);
$new_file = './file_uploads/report_file/' . $file_info_idx.'_tmp.'.$file_ext;
$writer->save($new_file);
  • original file原始文件

enter image description here在此处输入图像描述

  • write new file写入新文件

enter image description here在此处输入图像描述

As above, if you save a picture or image of a specific sheet in the original file as a new file, the picture or image will be lost.如上,如果将原始文件中特定工作表的图片或图像另存为新文件,则该图片或图像将丢失。 ex) sheet2例如)工作表 2

Is there something I'm missing out on?我错过了什么吗?

PHPSpreadsheet writes not in the original file. PHPSpreadsheet 不写入原始文件。 It produce a copy.它产生一个副本。 Some excel features are not supported and will not show in the new file.一些 excel 功能不受支持,不会在新文件中显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM