mirror of
https://github.com/php/doc-en.git
synced 2026-03-23 23:32:18 +01:00
Fix xlswriter examples (#3294)
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title>example</title>
|
||||
<title>Align style example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -59,16 +59,15 @@ $config = [
|
||||
'path' => './tests'
|
||||
];
|
||||
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel->fileName('tutorial01.xlsx');
|
||||
|
||||
$fileObject = $excel->fileName('tutorial01.xlsx');
|
||||
$fileHandle = $fileObject->getHandle();
|
||||
$format = new \Vtiful\Kernel\Format($excel->getHandle());
|
||||
$alignStyle = $format->align(\Vtiful\Kernel\Format::FORMAT_ALIGN_LEFT)->toResource();
|
||||
|
||||
$alignStyle = \Vtiful\Kernel\Format::align($fileHandle, \Vtiful\Kernel\Format::FORMAT_ALIGN_LEFT);
|
||||
|
||||
$fileObject->header(['name', 'age'])
|
||||
$excel->header(['name', 'age'])
|
||||
->data([['viest', 21]])
|
||||
->setColumn('A:A', 200, $align)
|
||||
->setColumn('A:A', 200, $alignStyle)
|
||||
->output();
|
||||
?>
|
||||
]]>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title>example</title>
|
||||
<title>Bold style example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -50,14 +50,13 @@ $config = [
|
||||
'path' => './tests'
|
||||
];
|
||||
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel->fileName('tutorial01.xlsx');
|
||||
|
||||
$fileObject = $excel->fileName('tutorial01.xlsx');
|
||||
$fileHandle = $fileObject->getHandle();
|
||||
$format = new \Vtiful\Kernel\Format($excel->getHandle());
|
||||
$boldStyle = $format->bold()->toResource();
|
||||
|
||||
$boldStyle = \Vtiful\Kernel\Format::bold($fileHandle);
|
||||
|
||||
$fileObject->header(['name', 'age'])
|
||||
$excel->header(['name', 'age'])
|
||||
->data([['viest', 21]])
|
||||
->setColumn('A:A', 200, $boldStyle)
|
||||
->output();
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title>example</title>
|
||||
<title>Italic style example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -50,14 +50,13 @@ $config = [
|
||||
'path' => './tests'
|
||||
];
|
||||
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel->fileName('tutorial01.xlsx');
|
||||
|
||||
$fileObject = $excel->fileName('tutorial01.xlsx');
|
||||
$fileHandle = $fileObject->getHandle();
|
||||
$format = new \Vtiful\Kernel\Format($excel->getHandle());
|
||||
$italicStyle = $format->italic()->toResource();
|
||||
|
||||
$italicStyle = \Vtiful\Kernel\Format::italic($fileHandle);
|
||||
|
||||
$fileObject->header(['name', 'age'])
|
||||
$excel->header(['name', 'age'])
|
||||
->data([['viest', 21]])
|
||||
->setColumn('A:A', 200, $italicStyle)
|
||||
->output();
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title>example</title>
|
||||
<title>Underline style example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -59,14 +59,13 @@ $config = [
|
||||
'path' => './tests'
|
||||
];
|
||||
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel->fileName('tutorial01.xlsx');
|
||||
|
||||
$fileObject = $excel->fileName('tutorial01.xlsx');
|
||||
$fileHandle = $fileObject->getHandle();
|
||||
$format = new \Vtiful\Kernel\Format($excel->getHandle());
|
||||
$underlineStyle = $format->underline(\Vtiful\Kernel\Format::UNDERLINE_SINGLE)->toResource();
|
||||
|
||||
$underlineStyle = \Vtiful\Kernel\Format::underline($fileHandle, \Vtiful\Kernel\Format::UNDERLINE_SINGLE);
|
||||
|
||||
$fileObject->header(['name', 'age'])
|
||||
$excel->header(['name', 'age'])
|
||||
->data([['viest', 21]])
|
||||
->setColumn('A:A', 200, $underlineStyle)
|
||||
->output();
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title>example</title>
|
||||
<title>setColumn example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -68,14 +68,13 @@ $config = [
|
||||
'path' => './tests'
|
||||
];
|
||||
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel->fileName('tutorial01.xlsx');
|
||||
|
||||
$fileObject = $excel->fileName('tutorial01.xlsx');
|
||||
$fileHandle = $fileObject->getHandle();
|
||||
$format = new \Vtiful\Kernel\Format($excel->getHandle());
|
||||
$boldStyle = $format->bold()->toResource();
|
||||
|
||||
$boldStyle = \Vtiful\Kernel\Format::bold($fileHandle);
|
||||
|
||||
$fileObject->header(['name', 'age'])
|
||||
$excel->header(['name', 'age'])
|
||||
->data([['viest', 21]])
|
||||
->setColumn('A:A', 200, $boldStyle)
|
||||
->output();
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title>example</title>
|
||||
<title>setRow example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -68,16 +68,15 @@ $config = [
|
||||
'path' => './tests'
|
||||
];
|
||||
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$excel->fileName('tutorial01.xlsx');
|
||||
|
||||
$fileObject = $excel->fileName('tutorial01.xlsx');
|
||||
$fileHandle = $fileObject->getHandle();
|
||||
$format = new \Vtiful\Kernel\Format($excel->getHandle());
|
||||
$boldStyle = $format->bold()->toResource();
|
||||
|
||||
$boldStyle = \Vtiful\Kernel\Format::bold($fileHandle);
|
||||
|
||||
$fileObject->header(['name', 'age'])
|
||||
$excel->header(['name', 'age'])
|
||||
->data([['viest', 21]])
|
||||
->setRow('A1', 20, $boldStyle,)
|
||||
->setRow('A1', 20, $boldStyle)
|
||||
->output();
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
Reference in New Issue
Block a user