Skip to content

Commit dcf3b98

Browse files
committed
Code highlight in docs for PhpStorm
1 parent b9a5966 commit dcf3b98

13 files changed

+258
-258
lines changed

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ When you make use of any of the worksheet protection features (e.g. cell
2323
range protection, prohibiting deleting rows, ...), make sure you enable
2424
worksheet security. This can for example be done like this:
2525

26-
``` php
26+
```php
2727
$spreadsheet->getActiveSheet()->getProtection()->setSheet(true);
2828
```
2929

docs/topics/accessing-cells.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ topic lists some of the options to access a cell.
88
Setting a cell value by coordinate can be done using the worksheet's
99
`setCellValue()` method.
1010

11-
``` php
11+
```php
1212
// Set cell A1 with a string value
1313
$spreadsheet->getActiveSheet()->setCellValue('A1', 'PhpSpreadsheet');
1414

@@ -28,7 +28,7 @@ $spreadsheet->getActiveSheet()->setCellValue(
2828
Alternatively, you can retrieve the cell object, and then call the
2929
cell’s `setValue()` method:
3030

31-
``` php
31+
```php
3232
$spreadsheet->getActiveSheet()
3333
->getCell('B8')
3434
->setValue('Some value');
@@ -56,7 +56,7 @@ the cell object will still retain its data values.
5656

5757
What does this mean? Consider the following code:
5858

59-
```
59+
```php
6060
$spreadSheet = new Spreadsheet();
6161
$workSheet = $spreadSheet->getActiveSheet();
6262

@@ -74,7 +74,7 @@ $cellA1 = $workSheet->getCell('A1');
7474
echo 'Value: ', $cellA1->getValue(), '; Address: ', $cellA1->getCoordinate(), PHP_EOL;
7575

7676
echo 'Value: ', $cellC1->getValue(), '; Address: ', $cellC1->getCoordinate(), PHP_EOL;
77-
```
77+
```
7878

7979
The call to `getCell('C1')` returns the cell at `C1` containing its value (`3`),
8080
together with its link to the collection (used to identify its
@@ -153,7 +153,7 @@ was a formula.
153153

154154
To do this, you need to "escape" the value by setting it as "quoted text".
155155

156-
```
156+
```php
157157
// Set cell A4 with a formula
158158
$spreadsheet->getActiveSheet()->setCellValue(
159159
'A4',
@@ -175,7 +175,7 @@ point value), and a number format mask is used to show how that value
175175
should be formatted; so if we want to store a date in a cell, we need to
176176
calculate the correct Excel timestamp, and set a number format mask.
177177

178-
``` php
178+
```php
179179
// Get the current date/time and convert to an Excel date/time
180180
$dateTimeNow = time();
181181
$excelDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel( $dateTimeNow );
@@ -210,7 +210,7 @@ behaviour.
210210
Firstly, you can set the datatype explicitly as a string so that it is
211211
not converted to a number.
212212

213-
``` php
213+
```php
214214
// Set cell A8 with a numeric value, but tell PhpSpreadsheet it should be treated as a string
215215
$spreadsheet->getActiveSheet()->setCellValueExplicit(
216216
'A8',
@@ -222,7 +222,7 @@ $spreadsheet->getActiveSheet()->setCellValueExplicit(
222222
Alternatively, you can use a number format mask to display the value
223223
with leading zeroes.
224224

225-
``` php
225+
```php
226226
// Set cell A9 with a numeric value
227227
$spreadsheet->getActiveSheet()->setCellValue('A9', 1513789642);
228228
// Set a number format mask to display the value as 11 digits with leading zeroes
@@ -236,7 +236,7 @@ $spreadsheet->getActiveSheet()->getStyle('A9')
236236
With number format masking, you can even break up the digits into groups
237237
to make the value more easily readable.
238238

239-
``` php
239+
```php
240240
// Set cell A10 with a numeric value
241241
$spreadsheet->getActiveSheet()->setCellValue('A10', 1513789642);
242242
// Set a number format mask to display the value as 11 digits with leading zeroes
@@ -259,7 +259,7 @@ writers (Xlsx and Xls).
259259
It is also possible to set a range of cell values in a single call by
260260
passing an array of values to the `fromArray()` method.
261261

262-
``` php
262+
```php
263263
$arrayData = [
264264
[NULL, 2010, 2011, 2012],
265265
['Q1', 12, 15, 21],
@@ -282,7 +282,7 @@ If you pass a 2-d array, then this will be treated as a series of rows
282282
and columns. A 1-d array will be treated as a single row, which is
283283
particularly useful if you're fetching an array of data from a database.
284284

285-
``` php
285+
```php
286286
$rowArray = ['Value1', 'Value2', 'Value3', 'Value4'];
287287
$spreadsheet->getActiveSheet()
288288
->fromArray(
@@ -299,7 +299,7 @@ If you have a simple 1-d array, and want to write it as a column, then
299299
the following will convert it into an appropriately structured 2-d array
300300
that can be fed to the `fromArray()` method:
301301

302-
``` php
302+
```php
303303
$rowArray = ['Value1', 'Value2', 'Value3', 'Value4'];
304304
$columnArray = array_chunk($rowArray, 1);
305305
$spreadsheet->getActiveSheet()
@@ -319,7 +319,7 @@ To retrieve the value of a cell, the cell should first be retrieved from
319319
the worksheet using the `getCell()` method. A cell's value can be read
320320
using the `getValue()` method.
321321

322-
``` php
322+
```php
323323
// Get the value from cell A1
324324
$cellValue = $spreadsheet->getActiveSheet()->getCell('A1')->getValue();
325325
```
@@ -331,7 +331,7 @@ value rather than the formula itself, then use the cell's
331331
`getCalculatedValue()` method. This is further explained in
332332
[the calculation engine](./calculation-engine.md).
333333

334-
``` php
334+
```php
335335
// Get the value from cell A4
336336
$cellValue = $spreadsheet->getActiveSheet()->getCell('A4')->getCalculatedValue();
337337
```
@@ -340,7 +340,7 @@ Alternatively, if you want to see the value with any cell formatting
340340
applied (e.g. for a human-readable date or time value), then you can use
341341
the cell's `getFormattedValue()` method.
342342

343-
``` php
343+
```php
344344
// Get the value from cell A6
345345
$cellValue = $spreadsheet->getActiveSheet()->getCell('A6')->getFormattedValue();
346346
```
@@ -350,7 +350,7 @@ $cellValue = $spreadsheet->getActiveSheet()->getCell('A6')->getFormattedValue();
350350
Setting a cell value by coordinate can be done using the worksheet's
351351
`setCellValueByColumnAndRow()` method.
352352

353-
``` php
353+
```php
354354
// Set cell A5 with a string value
355355
$spreadsheet->getActiveSheet()->setCellValueByColumnAndRow(1, 5, 'PhpSpreadsheet');
356356
```
@@ -363,15 +363,15 @@ To retrieve the value of a cell, the cell should first be retrieved from
363363
the worksheet using the `getCellByColumnAndRow()` method. A cell’s value can
364364
be read again using the following line of code:
365365

366-
``` php
366+
```php
367367
// Get the value from cell B5
368368
$cellValue = $spreadsheet->getActiveSheet()->getCellByColumnAndRow(2, 5)->getValue();
369369
```
370370

371371
If you need the calculated value of a cell, use the following code. This
372372
is further explained in [the calculation engine](./calculation-engine.md).
373373

374-
``` php
374+
```php
375375
// Get the value from cell A4
376376
$cellValue = $spreadsheet->getActiveSheet()->getCellByColumnAndRow(1, 4)->getCalculatedValue();
377377
```
@@ -382,7 +382,7 @@ It is also possible to retrieve a range of cell values to an array in a
382382
single call using the `toArray()`, `rangeToArray()` or
383383
`namedRangeToArray()` methods.
384384

385-
``` php
385+
```php
386386
$dataArray = $spreadsheet->getActiveSheet()
387387
->rangeToArray(
388388
'C3:E5', // The worksheet range that we want to retrieve
@@ -409,7 +409,7 @@ cells within a row.
409409
Below is an example where we read all the values in a worksheet and
410410
display them in a table.
411411

412-
``` php
412+
```php
413413
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
414414
$reader->setReadDataOnly(TRUE);
415415
$spreadsheet = $reader->load("test.xlsx");
@@ -456,7 +456,7 @@ loops.
456456
Below is an example where we read all the values in a worksheet and
457457
display them in a table.
458458

459-
``` php
459+
```php
460460
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
461461
$reader->setReadDataOnly(TRUE);
462462
$spreadsheet = $reader->load("test.xlsx");
@@ -482,7 +482,7 @@ echo '</table>' . PHP_EOL;
482482
Alternatively, you can take advantage of PHP's "Perl-style" character
483483
incrementors to loop through the cells by coordinate:
484484

485-
``` php
485+
```php
486486
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
487487
$reader->setReadDataOnly(TRUE);
488488
$spreadsheet = $reader->load("test.xlsx");
@@ -528,7 +528,7 @@ dates entered as strings to the correct format, also setting the cell's
528528
style information. The following example demonstrates how to set the
529529
value binder in PhpSpreadsheet:
530530

531-
``` php
531+
```php
532532
/** PhpSpreadsheet */
533533
require_once 'src/Boostrap.php';
534534

docs/topics/architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ PhpSpreadsheet supports fluent interfaces in most locations. This means
4343
that you can easily "chain" calls to specific methods without requiring
4444
a new PHP statement. For example, take the following code:
4545

46-
``` php
46+
```php
4747
$spreadsheet->getProperties()->setCreator("Maarten Balliauw");
4848
$spreadsheet->getProperties()->setLastModifiedBy("Maarten Balliauw");
4949
$spreadsheet->getProperties()->setTitle("Office 2007 XLSX Test Document");
@@ -55,7 +55,7 @@ $spreadsheet->getProperties()->setCategory("Test result file");
5555

5656
This can be rewritten as:
5757

58-
``` php
58+
```php
5959
$spreadsheet->getProperties()
6060
->setCreator("Maarten Balliauw")
6161
->setLastModifiedBy("Maarten Balliauw")

0 commit comments

Comments
 (0)