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

Added extractVariables method to IOFactory #2515

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
4bb74e2
Added extractVariables method to IOFactory
sibalonat Nov 30, 2023
993560f
remove var_dumps
sibalonat Nov 30, 2023
43df798
Merge branch 'master' into Word2007-Reader---Extract-variables-from-word
sibalonat Nov 30, 2023
b01e266
remove vardump
sibalonat Nov 30, 2023
9268ba5
fix return and fix php stan errors and instances
sibalonat Nov 30, 2023
bf69d18
fix order and whitespace
sibalonat Nov 30, 2023
e6ba84a
extra space
sibalonat Nov 30, 2023
c90df91
remove new lines
sibalonat Nov 30, 2023
41beb2d
white space
sibalonat Nov 30, 2023
a08da1e
new lines
sibalonat Nov 30, 2023
96a4ea1
whiteline
sibalonat Nov 30, 2023
170339e
new line
sibalonat Nov 30, 2023
7be3cdb
white space
sibalonat Nov 30, 2023
42673c9
fix
sibalonat Nov 30, 2023
0b8f9f4
new line
sibalonat Nov 30, 2023
33b1d0c
white space
sibalonat Nov 30, 2023
f618d67
remove some unneecessary if statement
sibalonat Nov 30, 2023
447b3fd
Correct Font Size Calculated by MsDoc Reader
oleibman Dec 17, 2023
7173e21
Suggestions from @Progi1984
oleibman Dec 17, 2023
4ae15ba
Typo Tolerated By Windows but Not By Unix
oleibman Dec 17, 2023
5bc9c6a
Correct Title Line of Change Log
oleibman Dec 17, 2023
fb81631
Bump dompdf/dompdf from 2.0.3 to 2.0.4
dependabot[bot] Dec 13, 2023
fbff29b
Bump phpunit/phpunit from 9.6.13 to 9.6.14
dependabot[bot] Dec 1, 2023
d353048
Bump mpdf/mpdf from 8.2.0 to 8.2.2
dependabot[bot] Dec 28, 2023
8b8dfce
Bump phpmd/phpmd from 2.14.1 to 2.15.0
dependabot[bot] Jan 1, 2024
ada4754
Updated Changelog
Progi1984 Jan 6, 2024
a402ece
Bump phpunit/phpunit from 9.6.14 to 9.6.15
dependabot[bot] Jan 6, 2024
400f524
Updated Changelog
Progi1984 Jan 6, 2024
24634cc
Bump symfony/process from 5.4.28 to 5.4.34
dependabot[bot] Jan 1, 2024
8200e9d
Updated Changelog
Progi1984 Jan 6, 2024
12d0660
Added extractVariables method to IOFactory
sibalonat Nov 30, 2023
d51ce7e
remove var_dumps
sibalonat Nov 30, 2023
3523d2f
fix return and fix php stan errors and instances
sibalonat Nov 30, 2023
b884cbc
fix order and whitespace
sibalonat Nov 30, 2023
e4a6a43
remove new lines
sibalonat Nov 30, 2023
3a252ed
white space
sibalonat Nov 30, 2023
42d1a95
new lines
sibalonat Nov 30, 2023
3fdd8b4
whiteline
sibalonat Nov 30, 2023
5fc5d46
new line
sibalonat Nov 30, 2023
cac3256
white space
sibalonat Nov 30, 2023
cd5a155
fix
sibalonat Nov 30, 2023
c0338f5
white space
sibalonat Nov 30, 2023
6b86c52
remove some unneecessary if statement
sibalonat Nov 30, 2023
309b616
variable changes
sibalonat Jan 7, 2024
2a28c1e
2.0.0 md
sibalonat Jan 7, 2024
68d9bd8
2.0.0
sibalonat Jan 7, 2024
5b6b2a9
Merge branch 'master' into Word2007-Reader---Extract-variables-from-word
sibalonat Jan 7, 2024
dd5fc0d
new line at end of the file
sibalonat Jan 7, 2024
60b416f
add entry to md
sibalonat Jan 7, 2024
53e08d5
additional space, type fixes in enhancement md and iofactory
sibalonat Jan 7, 2024
fda7405
Merge branch 'master' into Word2007-Reader---Extract-variables-from-word
sibalonat Jan 7, 2024
5b4f434
some fixes on spacing
sibalonat Jan 7, 2024
56feaf3
based on fixer suggestions
sibalonat Jan 7, 2024
d3eac68
new line at the end of the file
sibalonat Jan 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Correct Font Size Calculated by MsDoc Reader
Fix #2526. Most of that issue has already been fixed. The one remaining problem was a deprecation message handling font size. The code used `dechex($operand / 2)`, and issued the deprecation message whenever `$operand` was odd because `dechex` is designed only for integer conversion. `$operand` is actually 2 times the point size, so it will be odd only when the point size is some integer plus half a point (no other fractions are allowed). At any rate, it seems that `dechex` should not be used here in the first place; font size is a numeric value, not a hex string.

There are many problems with MsDoc Reader at the moment. This PR is narrowly focused on the problem at hand. Its test is, at least, more detailed than the existing MsDoc Reader test, which does nothing more than confirm that read successfully creates a PhpWord object. The new test verifies that the font size is as expected, but does not validate any other aspect of the read.
  • Loading branch information
oleibman authored and sibalonat committed Jan 7, 2024
commit 447b3fd1f31ebf2ef6f16132bd4d597e0f545d60
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/MsDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ private function readPrl($data, $pos, $cbNum)
break;
// sprmCHps
case 0x43:
$oStylePrl->styleFont['size'] = dechex($operand / 2);
$oStylePrl->styleFont['size'] = $operand / 2;

break;
// sprmCIss
Expand Down
16 changes: 16 additions & 0 deletions tests/PhpWordTests/Reader/MsDocTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ public function testLoad(): void
self::assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord);
}

public function testLoadHalfPointFont(): void
{
$filename = __DIR__ . '/../_files/documents/word.2526.doc';
$phpWord = IOFactory::load($filename, 'MsDoc');
$sections = $phpWord->getSections();
self::assertCount(1, $sections);
$elements = $sections[0]->getElements();
self::assertArrayHasKey(0, $elements);
$element0 = $elements[0];
if (method_exists($element0, 'getFontStyle')) {
self::assertSame(19.5, $element0->getFontStyle()->getSize());
} else {
self::fail('Unexpected no font style for first element');
}
}

/**
* Test exception on not existing file.
*/
Expand Down
Binary file not shown.