Skip to content

Fix documentation and method name for FootnoteProperties #1776

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

Merged
merged 2 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/elements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -359,17 +359,17 @@ The footnote numbering can be controlled by setting the FootnoteProperties on th

.. code-block:: php

$fp = new PhpWord\SimpleType\FootnoteProperties();
$fp = new \PhpOffice\PhpWord\ComplexType\FootnoteProperties();
//sets the position of the footnote (pageBottom (default), beneathText, sectEnd, docEnd)
$fp->setPos(FootnoteProperties::POSITION_DOC_END);
$fp->setPos(\PhpOffice\PhpWord\ComplexType\FootnoteProperties::POSITION_BENEATH_TEXT);
//set the number format to use (decimal (default), upperRoman, upperLetter, ...)
$fp->setNumFmt(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN);
$fp->setNumFmt(\PhpOffice\PhpWord\SimpleType\NumberFormat::LOWER_ROMAN);
//force starting at other than 1
$fp->setNumStart(2);
//when to restart counting (continuous (default), eachSect, eachPage)
$fp->setNumRestart(FootnoteProperties::RESTART_NUMBER_EACH_PAGE);
$fp->setNumRestart(\PhpOffice\PhpWord\ComplexType\FootnoteProperties::RESTART_NUMBER_EACH_PAGE);
//And finaly, set it on the Section
$section->setFootnoteProperties($properties);
$section->setFootnoteProperties($fp);

Checkboxes
----------
Expand Down
12 changes: 12 additions & 0 deletions src/PhpWord/Element/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,18 @@ public function getFooters()
*
* @return FootnoteProperties
*/
public function getFootnoteProperties()
{
return $this->footnoteProperties;
}

/**
* Get the footnote properties
*
* @deprecated Use the `getFootnoteProperties` method instead
*
* @return FootnoteProperties
*/
public function getFootnotePropoperties()
{
return $this->footnoteProperties;
Expand Down
20 changes: 10 additions & 10 deletions src/PhpWord/Writer/Word2007/Part/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,27 +126,27 @@ private function writeSectionSettings(XMLWriter $xmlWriter, Section $section)
$xmlWriter->endElement();
}

//footnote properties
if ($section->getFootnotePropoperties() !== null) {
// Footnote properties
if ($section->getFootnoteProperties() !== null) {
$xmlWriter->startElement('w:footnotePr');
if ($section->getFootnotePropoperties()->getPos() != null) {
if ($section->getFootnoteProperties()->getPos() != null) {
$xmlWriter->startElement('w:pos');
$xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getPos());
$xmlWriter->writeAttribute('w:val', $section->getFootnoteProperties()->getPos());
$xmlWriter->endElement();
}
if ($section->getFootnotePropoperties()->getNumFmt() != null) {
if ($section->getFootnoteProperties()->getNumFmt() != null) {
$xmlWriter->startElement('w:numFmt');
$xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getNumFmt());
$xmlWriter->writeAttribute('w:val', $section->getFootnoteProperties()->getNumFmt());
$xmlWriter->endElement();
}
if ($section->getFootnotePropoperties()->getNumStart() != null) {
if ($section->getFootnoteProperties()->getNumStart() != null) {
$xmlWriter->startElement('w:numStart');
$xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getNumStart());
$xmlWriter->writeAttribute('w:val', $section->getFootnoteProperties()->getNumStart());
$xmlWriter->endElement();
}
if ($section->getFootnotePropoperties()->getNumRestart() != null) {
if ($section->getFootnoteProperties()->getNumRestart() != null) {
$xmlWriter->startElement('w:numRestart');
$xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getNumRestart());
$xmlWriter->writeAttribute('w:val', $section->getFootnoteProperties()->getNumRestart());
$xmlWriter->endElement();
}
$xmlWriter->endElement();
Expand Down