Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access External Workbook #4075

Open
CosminCotulbea opened this issue Jun 26, 2024 · 4 comments
Open

Unable to access External Workbook #4075

CosminCotulbea opened this issue Jun 26, 2024 · 4 comments

Comments

@CosminCotulbea
Copy link

CosminCotulbea commented Jun 26, 2024

Hello,

I have this issues where i get this error "Unable to access External Workbook".
I'm trying to convert an xlsx file into a pdf or html but on writer save i get this error.

I tryed in two ways:
1)

$xml = new PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$xml->setIncludeCharts(true);
$spreadsheet = $xml->load($localTempFile);
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet);
$writer->setIncludeCharts(true);
$writer->writeAllSheets();
$writer->save('throwing_excel.html');

$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
$reader->setIncludeCharts(true);
$document = $reader->load($localTempFile);
$writer = new Dompdf($document);
$writer->setIncludeCharts(true);
$writer->save('throwing_excel.pdf');

The error is thrown when I call the save method on the last row.

@CosminCotulbea
Copy link
Author

I forget to tell that I have some charts and use this in appServiceProvider

\PhpOffice\PhpSpreadsheet\Settings::setChartRenderer(
\PhpOffice\PhpSpreadsheet\Chart\Renderer\MtJpGraphRenderer::class
);

If i remove this part from provider everything work but the charts will not appear in the generated file.

@oleibman
Copy link
Collaborator

Unable to duplicate - using your code, I have no problem saving in either Html or Dompdf including the graph. Can you upload the spreadsheet that is giving you a problem?

@CosminCotulbea
Copy link
Author

with a new xlsx file only with a simple chart and some data i get an other error
image

@CosminCotulbea
Copy link
Author

I found that the file was corrupted but now i have a problem with that charts with data from other sheets: "Call to a member function getDataValue() on false"

If i remove that charts everything work but while i have that charts with data from other sheet throw this error on save.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants