Reorganize Samples

The samples have become unwieldy when running them from a browser. In particular, the drop-down lists are fixed size with no scrolling, and many of them are now just too large. I have moved all the Calculation samples up a level, and broken several categories (Basic, Chart, DateTime, Engineering, Financial, and Reader) into several pieces.

Convert-Online (now found in the Engineering category) had a number of different problems which are now resolved. It is the only member with any significant code change.
This commit is contained in:
oleibman
2024-02-03 07:25:29 -08:00
parent 22f4d6ee17
commit b3de003aa5
226 changed files with 33 additions and 30 deletions
+54
View File
@@ -0,0 +1,54 @@
<?php
use PhpOffice\PhpSpreadsheet\Spreadsheet;
require __DIR__ . '/../../Header.php';
$category = 'Engineering';
$functionName = 'BITAND';
$description = "Returns a bitwise 'AND' of two numbers";
$helper->titles($category, $functionName, $description);
// Create new PhpSpreadsheet object
$spreadsheet = new Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data
$testData = [
[1, 5],
[3, 5],
[1, 6],
[9, 6],
[13, 25],
[23, 10],
];
$testDataCount = count($testData);
$worksheet->fromArray($testData, null, 'A1', true);
for ($row = 1; $row <= $testDataCount; ++$row) {
$worksheet->setCellValue('C' . $row, '=TEXT(DEC2BIN(A' . $row . '), "00000")');
$worksheet->setCellValue('D' . $row, '=TEXT(DEC2BIN(B' . $row . '), "00000")');
$worksheet->setCellValue('E' . $row, '=BITAND(A' . $row . ',B' . $row . ')');
$worksheet->setCellValue('F' . $row, '=TEXT(DEC2BIN(E' . $row . '), "00000")');
}
// Test the formulae
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(E$row): Bitwise AND of "
. $worksheet->getCell('A' . $row)->getValue()
. ' ('
. $worksheet->getCell('C' . $row)->getCalculatedValue()
. ') and '
. $worksheet->getCell('B' . $row)->getValue()
. '('
. $worksheet->getCell('D' . $row)->getCalculatedValue()
. ') is '
. $worksheet->getCell('E' . $row)->getCalculatedValue()
. ' ('
. $worksheet->getCell('F' . $row)->getCalculatedValue()
. ')'
);
}