mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-17 20:52:21 +00:00
623caa89bc
* Changes for Chart Rendering Samples PR #3521 added chart rendering to the 33* samples. Some of those samples had rendering problems; this PR fixes some of the errors by changing some of the code in JpGraphRendererBase. I am discussing approaches to some other problems with mitoteam. The changes in 3521 applied only when running the samples as web pages. A new member 35_Chart_render33 is added to do the same when running the samples from the command line. Because of 3521, 35_Chart_render and new 35_Chart_render33 (in web page mode) display rendering which is already displayed by other samples and so are superfluous as web pages, so they are no longer presented as options. The samples in 35_Chart_render properly accounted for multiple charts on a single worksheet, but did not properly account for charts on multiple worksheets. This problem is fixed. 33_Chart_create_stock2 was added using a base from before 3521, but did not incorporate the 3521 changes. It now does so. 32_Chart_read_write_HTML and 32_Chart_read_write_PDF are made consistent with the 32* Xlsx samples by allowing the download of the generated file when run as web pages. Helper/Downloader needed a minor change to support Html. Some of the changes in PR #3522 require the Downloader change to work properly. Some samples which were not changed by 3522 are changed in this PR to give a more uniform look and feel to the web samples. * Scrutinizer Fix class name conflict. Ignore "complexity" problem. * Improve Sample 26 The UTF8 sample 26 includes CJK characters. These are generated in Xls, Xlsx, Html, and Csv (with BOM) correctly. Csv without BOM has a problem, but that's Microsoft's problem, not ours. That leaves PDF, which currently does not display the CJK characters (nor a Latin extension character). Mpdf, in combination with editHtmlCallback (and earlier commits in this PR), can support them; change the sample to do so. Dompdf, which had been used for the sample, apparently supported Web Fonts at one time, which might also have solved this problem, but no longer seems to do so. * Fix Style Problem Need blank line. * Change Some Spacing in Source Code Make Header PSR12-compliant.
23 lines
515 B
PHP
23 lines
515 B
PHP
<?php
|
|
|
|
use PhpOffice\PhpSpreadsheet\Writer\Html;
|
|
|
|
require __DIR__ . '/../Header.php';
|
|
$spreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php';
|
|
|
|
function changeGridlines(string $html): string
|
|
{
|
|
return str_replace('{border: 1px solid black;}', '{border: 2px dashed red;}', $html);
|
|
}
|
|
|
|
$helper->write(
|
|
$spreadsheet,
|
|
__FILE__,
|
|
['Html'],
|
|
false,
|
|
function (Html $writer): void {
|
|
$writer->setEmbedImages(true);
|
|
$writer->setEditHtmlCallback('changeGridlines');
|
|
}
|
|
);
|