Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature footnote support#1392

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
tiberlas wants to merge7 commits intopython-openxml:develop
base:develop
Choose a base branch
Loading
fromopenlawlibrary:feature/footnote-upstream

Conversation

tiberlas
Copy link

Hi,
I've created footnote support. To the API I added functions:

  • Can read footnotes from a paragraph as a list. The footnote object contains footnote reference id and paragraphs.
doc = Document('test.docx')paragraph = doc.paragraphs[0]footnotes = paragraph.footnotesfor footnote in footnotes:    print(f'footnote reference id: {footnote.id}')    print(f'this footnote has paragraphs: {len(footnote.paragraphs)}')
  • Can access all footnotes in a document as a list where the list index is footnote reference id for that footnote
doc = Document('test.docx')for footnote in doc.footnotes:    print(f'footnote reference id: {footnote.id}')    print(f'this footnote has paragraphs: {len(footnote.paragraphs)}')
  • Can add a footnote to the end of a paragraph. The footnote reference id is calculated based on the other footnotes in the document. On a created footnote object you can add paragraphs.
doc = Document('test.docx')paragraph = doc.paragraphs[0]new_footnote = paragraph.add_footnote()new_footnote.add_paragraph('paragraph in footnote')
  • Can read and change footnote properties in a section.
doc = Document('test.docx')s = doc.section[0]print(s.footnote_position)print(s.footnote_number_format)print(s.footnote_numbering_start_value)print(s.footnote_numbering_restart_location)s.footnote_position = 'beneathText's.footnote_number_format = 'hex's.footnote_numbering_start_value = 4s.footnote_numbering_restart_location = 'eachPage'

@Cerebex
Copy link

@scanny Any updates on merging footnote support into the library?

@Cerebex
Copy link

Cerebex commentedOct 29, 2024
edited
Loading

@tiberlas I tested this update locally and it works great. I wish it was merged since being able to pull footnotes from the exact paragraph that they are referenced in great!

@scanny Happy to help with work to merge this into main if you would like support.

@afultonuq
Copy link

Would also be keen to see this one merged in@scanny!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@tiberlas@Cerebex@afultonuq

[8]ページ先頭

©2009-2025 Movatter.jp