|
18 | 18 |
|
19 | 19 | assert($xlsxFastEditor->readFloat($sheet1, 'D2') === 3.14159); |
20 | 20 | assert($xlsxFastEditor->readFloat($sheet1, 'D4') === -1.0); |
21 | | -assert($xlsxFastEditor->readFloat($sheet1, 'E5') === null); |
| 21 | +assert($xlsxFastEditor->readFloat($sheet1, 'e5') === null); |
22 | 22 | assert($xlsxFastEditor->readInt($sheet1, 'c3') === -5); |
23 | 23 | assert($xlsxFastEditor->readInt($sheet1, 'F6') === null); |
24 | | -assert($xlsxFastEditor->readString($sheet1, 'B4') === 'naïveté'); |
| 24 | +assert($xlsxFastEditor->readString($sheet1, 'b4') === 'naïveté'); |
25 | 25 | assert($xlsxFastEditor->readString($sheet1, 'F7') === null); |
26 | 26 |
|
27 | 27 | $sheet2 = $xlsxFastEditor->getWorksheetNumber('Sheet2'); |
28 | 28 | assert($sheet2 === 2); |
29 | 29 |
|
| 30 | +assert($xlsxFastEditor->readFormula($sheet2, 'c2') === '=Sheet1!C2*2'); |
30 | 31 | assert($xlsxFastEditor->readFloat($sheet2, 'D2') === 3.14159 * 2); |
31 | 32 | assert($xlsxFastEditor->readFloat($sheet2, 'D4') === -1.0 * 2); |
32 | 33 | assert($xlsxFastEditor->readInt($sheet2, 'c3') === -5 * 2); |
33 | 34 | assert($xlsxFastEditor->readString($sheet2, 'B3') === 'déjà-vu'); |
34 | 35 |
|
35 | 36 | // Existing cells |
36 | | -$xlsxFastEditor->writeString($sheet1, 'B4', 'α'); |
37 | | -$xlsxFastEditor->writeInt($sheet1, 'C4', 15); |
38 | | -$xlsxFastEditor->writeFloat($sheet1, 'D4', -66.6); |
| 37 | +$xlsxFastEditor->writeFormula($sheet1, 'c2', '=2*3'); |
| 38 | +$xlsxFastEditor->writeString($sheet1, 'b4', 'α'); |
| 39 | +$xlsxFastEditor->writeInt($sheet1, 'c4', 15); |
| 40 | +$xlsxFastEditor->writeFloat($sheet1, 'd4', -66.6); |
39 | 41 |
|
40 | 42 | // Existing cells with formulas |
| 43 | +$xlsxFastEditor->writeFormula($sheet2, 'c2', '=Sheet1!C2*3'); |
41 | 44 | $xlsxFastEditor->writeString($sheet2, 'B3', 'β'); |
42 | 45 | $xlsxFastEditor->writeInt($sheet2, 'C3', -7); |
43 | 46 | $xlsxFastEditor->writeFloat($sheet2, 'D3', 273.15); |
44 | 47 |
|
45 | 48 | // Non-existing cells but existing lines |
| 49 | +$xlsxFastEditor->writeFormula($sheet2, 'I2', '=7*3'); |
46 | 50 | $xlsxFastEditor->writeString($sheet2, 'F2', 'γ'); |
47 | 51 | $xlsxFastEditor->writeInt($sheet2, 'G3', -7); |
48 | 52 | $xlsxFastEditor->writeFloat($sheet2, 'H4', 273.15); |
49 | 53 |
|
50 | 54 | // Non-existing lines |
| 55 | +$xlsxFastEditor->writeFormula($sheet2, 'E11', '=7*5'); |
51 | 56 | $xlsxFastEditor->writeString($sheet2, 'B10', 'δ'); |
52 | 57 | $xlsxFastEditor->writeInt($sheet2, 'C9', 13); |
53 | 58 | $xlsxFastEditor->writeFloat($sheet2, 'D10', -273.15); |
|
58 | 63 |
|
59 | 64 | $xlsxFastEditor = new XlsxFastEditor(__DIR__ . '/copy.xlsx'); |
60 | 65 |
|
| 66 | +assert($xlsxFastEditor->readFormula($sheet1, 'c2') === '=2*3'); |
61 | 67 | assert($xlsxFastEditor->readString($sheet1, 'B4') === 'α'); |
62 | 68 | assert($xlsxFastEditor->readInt($sheet1, 'C4') === 15); |
63 | 69 | assert($xlsxFastEditor->readFloat($sheet1, 'D4') === -66.6); |
64 | 70 |
|
| 71 | +assert($xlsxFastEditor->readFormula($sheet2, 'c2') === '=Sheet1!C2*3'); |
65 | 72 | assert($xlsxFastEditor->readString($sheet2, 'B3') === 'β'); |
66 | 73 | assert($xlsxFastEditor->readInt($sheet2, 'C3') === -7); |
67 | 74 | assert($xlsxFastEditor->readFloat($sheet2, 'D3') === 273.15); |
68 | 75 |
|
| 76 | +assert($xlsxFastEditor->readFormula($sheet2, 'I2') === '=7*3'); |
69 | 77 | assert($xlsxFastEditor->readString($sheet2, 'F2') === 'γ'); |
70 | 78 | assert($xlsxFastEditor->readInt($sheet2, 'G3') === -7); |
71 | 79 | assert($xlsxFastEditor->readFloat($sheet2, 'H4') === 273.15); |
72 | 80 |
|
| 81 | +assert($xlsxFastEditor->readFormula($sheet2, 'E11') === '=7*5'); |
73 | 82 | assert($xlsxFastEditor->readString($sheet2, 'B10') === 'δ'); |
74 | 83 | assert($xlsxFastEditor->readInt($sheet2, 'C9') === 13); |
75 | 84 | assert($xlsxFastEditor->readFloat($sheet2, 'D10') === -273.15); |
|
0 commit comments