Skip to content

low-level support for comments & footnotes #624

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

Open
wants to merge 118 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
b6bacc3
comm: comment part added
Feb 25, 2019
b66eaf7
link paragraph to comment
Feb 26, 2019
53c7ec8
Merge pull request #1 from BayooG/feature/comments_lower_level
BayooG Feb 27, 2019
8668645
no message
Feb 28, 2019
1e64f02
acess comment data
Feb 28, 2019
e83940b
Merge pull request #2 from BayooG/feature/comments_lower_level
BayooG Feb 28, 2019
d5a4aa9
fix a bug /oxml/comments.py
BayooG Feb 28, 2019
2066e17
mini bug
Feb 28, 2019
ecb2ee5
mini bug
Feb 28, 2019
827a5bf
low level support for footnotes
Mar 1, 2019
64d3dfc
footnote id on run element
Mar 1, 2019
f1c48ce
Merge pull request #3 from BayooG/feature/low-level_support_for_footnote
BayooG Mar 1, 2019
76612ca
fixes
Mar 3, 2019
b0f2442
added wheel
BayooG Mar 4, 2019
70b28a4
Merge branch 'feature/low-level_support_for_footnote'
Mar 4, 2019
8098ef8
updated HISTORY.rst
Mar 7, 2019
b40c5b4
Merge remote-tracking branch 'origin/master'
Mar 7, 2019
0547bbd
V 0.1.3
Mar 7, 2019
3205e31
Merge branch 'release/0.1.3' into develop
Mar 20, 2019
db913ae
tbl : oxml elements inside tbl
Mar 20, 2019
326712b
Merge branch 'release/V.0.1.4' into develop
Mar 20, 2019
38ad5c1
Merge branch 'release/V.0.1.4'
Mar 20, 2019
a3d1f48
Merge branch 'master' into develop
Mar 20, 2019
27d24a0
Merge branch 'develop'
Mar 20, 2019
e6abc80
added emf support!
lone-bassel Mar 27, 2019
2e519dd
version update!
lone-bassel Mar 28, 2019
cb92773
Merge branch 'release/0.1.5' into develop
lone-bassel Mar 28, 2019
12c26fb
Merge branch 'release/0.1.5'
lone-bassel Mar 28, 2019
b04c0a1
CT_TblBoarders added
Apr 25, 2019
5685a3f
add tcBorders
Apr 28, 2019
0c31ecd
Merge branch 'develop'
Apr 28, 2019
c203563
oxml: convert CT_AbstractNum to xmlchemy
lone-bassel Apr 30, 2019
cb40382
release 0.1.8
Apr 30, 2019
da469e2
Merge branch 'release/0.1.8' into develop
Apr 30, 2019
06a11c0
Merge branch 'release/0.1.8'
Apr 30, 2019
0b99205
Merge branch 'develop' into feature/EMF_image_support
lone-bassel May 6, 2019
ea2f511
Version update!
lone-bassel May 6, 2019
1f8bcef
Merge branch 'release/0.1.9' into develop
lone-bassel May 6, 2019
1d29c42
Merge branch 'release/0.1.9'
lone-bassel May 6, 2019
8e93e43
Version Update!
lone-bassel May 7, 2019
8cabb18
Merge branch 'release/0.2.0' into develop
lone-bassel May 7, 2019
d621704
Merge branch 'release/0.2.0'
lone-bassel May 7, 2019
84e7f1e
ignore build folder
lone-bassel May 7, 2019
5418884
Merge branch 'master' into develop
lone-bassel May 7, 2019
348587b
font theme added!
lone-bassel Jun 27, 2019
599452a
Merge branch 'feature/fontTheme' into develop
lone-bassel Jun 27, 2019
8d325eb
docDefalts Styles added!
lone-bassel Jun 27, 2019
720678d
update version
lone-bassel Jun 27, 2019
1eb26c7
Merge branch 'release/0.2.2'
lone-bassel Jun 27, 2019
fc5289f
merged with upstream 0.8.10
BayooG Jul 4, 2019
6b8e802
Merge branch 'master' into feature/Headers&Sections
BayooG Jul 4, 2019
6ea78ec
get tables section
BayooG Jul 4, 2019
39bde29
Merge branch 'feature/Headers&Sections' into develop
BayooG Jul 4, 2019
e63bbad
Merge branch 'develop'
BayooG Jul 7, 2019
c671454
add element property for document object
BayooG Jul 13, 2019
8319e10
added element property to document object
BayooG Jul 15, 2019
e1dfaca
Merge branch 'feature/improvements' into develop
BayooG Jul 15, 2019
15aa87b
add abstractNumIds as attrib for document object
BayooG Sep 3, 2019
a2406dd
Merge branch 'feature/numbering_things' into develop
BayooG Sep 3, 2019
9965f2c
new attribs for Paragraph & Run
BayooG Sep 3, 2019
e68f53b
typos
BayooG Sep 6, 2019
5aadfab
fix- parent type
BayooG Sep 6, 2019
3e8ca7d
ignores
BayooG Sep 6, 2019
f29f50e
Merge pull request #4 from BayooG/feature/paragraph_run_addons
BayooG Sep 6, 2019
d2e1ca5
Merge branch 'develop'
BayooG Sep 6, 2019
ee60190
0.2.4
BayooG Sep 6, 2019
ca46e57
append paragraph works
BayooG Sep 26, 2019
32deb06
Merge branch 'hotfix/append_paragraph'
BayooG Sep 26, 2019
4287b07
Merge branch 'hotfix/append_paragraph' into develop
BayooG Sep 26, 2019
ff9e3a3
translate tag: "w:noBreakHyphen" to "-"
Jan 19, 2020
478edcc
Merge pull request #5 from idtareq/hotfix/noBreakHyphen
BayooG Jan 19, 2020
df916b5
Merge branch 'master' into develop
BayooG Jan 19, 2020
8d5fb53
add CONTRIBUTORS.md
BayooG Jan 19, 2020
8df4039
Merge branch 'release/0.2.6'
BayooG Jan 19, 2020
f6d7613
Merge branch 'release/0.2.6' into develop
BayooG Jan 19, 2020
8d74621
comment datetime
BayooG May 1, 2020
45c5681
update readme
BayooG May 1, 2020
1c51430
readme
BayooG May 1, 2020
5196e78
Merge pull request #6 from BayooG/hotfix/fix_comment_date
BayooG May 1, 2020
6204f12
fix rst formating
BayooG May 1, 2020
cf8df47
note in readme
BayooG May 1, 2020
94266f2
pypi rst format
BayooG May 1, 2020
6bdb559
add comments implementation on a run level
BayooG May 2, 2020
b566337
Merge 'master' into add_comments_on_run_level
BayooG May 2, 2020
db56c4c
update readme
BayooG May 2, 2020
2e68bb3
Merge pull request #7 from BayooG/feature/add_comments_on_run_level
BayooG May 2, 2020
d3870bc
PYPI DESCRIPTION
BayooG May 2, 2020
9cc96ae
Merge branch 'feature/add_comments_on_run_level'
BayooG May 2, 2020
c5ecc0b
.
BayooG May 2, 2020
a4dd0f6
pypi publish workflow
BayooG May 20, 2020
2941f32
.
BayooG May 20, 2020
1ab515d
.
BayooG May 20, 2020
ce19d55
update __version __
BayooG May 20, 2020
e982e54
update the action
BayooG May 20, 2020
1e8add7
Merge pull request #10 from BayooG/feature/update_develop
BayooG May 20, 2020
6048db5
pass comment part in add comment
BayooG Aug 17, 2020
32400b2
update version
BayooG Aug 17, 2020
a701b27
Merge branch 'hotfix/pass_comment_part_to_add_comment'
BayooG Aug 17, 2020
2ef9cba
update readme
BayooG Oct 23, 2020
dbca07f
update version
BayooG Oct 23, 2020
c634b2c
list and edit comments
BayooG Oct 23, 2020
0d4ba9a
update readme
BayooG Oct 23, 2020
1b7ddf0
Merge tag 'v0.2.12' into feature/paragraph_all_runs
BayooG Nov 3, 2020
7082f5d
all runs atrib
Nov 3, 2020
15b250e
Merge branch 'develop'
BayooG Nov 3, 2020
6ad5533
prepend and append comment elements
Nov 17, 2020
890b807
Merge pull request #11 from baltazarix/fix-commenting-particular-run
BayooG Nov 19, 2020
b89d402
Merge branch 'master' into develop
BayooG Nov 19, 2020
94c7152
update version
Nov 19, 2020
623ab28
Merge pull request #12 from BayooG/develop
BayooG Nov 19, 2020
9be99b3
Create add_ole_object_to_run func (#13)
ahmadalwareh Oct 31, 2022
87a2993
release version 0.2.15 (#14)
BayooG Oct 31, 2022
c7a413a
update version
BayooG Oct 31, 2022
62bfcde
Bugfix and Update README (#15)
ahmadalwareh Nov 1, 2022
5e1be28
update version
BayooG Nov 1, 2022
66528f6
feat: support `fldChar` and `instrText` elements (#17)
ahmadalwareh Feb 25, 2023
60ca063
chore: bump version to `0.2.20`
BayooG Feb 25, 2023
a998646
Update README.md (#20)
BayooG Jun 20, 2024
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
31 changes: 31 additions & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Publish on PYPI

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@
_scratch/
Session.vim
/.tox/
/build/
/tests/
/features/
/docs/
/ref/
14 changes: 14 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Bayoo-docx contributors

============================================

* **[Obay Daba](https://github.com/bayoog)**

* **[Bassel Al Madani](https://github.com/pepos9)**

* **[Tareq Ibrahim](https://github.com/idtareq)**

* **[baltazarix](https://github.com/baltazarix)**

* **[Ahmad Alwareh](https://github.com/ahmadalwareh)**

42 changes: 42 additions & 0 deletions DESCRIPTION.rst

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not implement a delete_comment() function as well?

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Bayoo-docx


Python library forked from `python-docx <github.com/python-openxml/python-docx/>`_.

The main purpose of the fork was to add implementation for comments and footnotes to the library

Installation


Use the package manager `pip <pypi.org/project/bayoo-docx/>`_ to install bayoo-docx.


`pip install bayoo-docx`

Usage


::

import docx

document = docx.Document()

paragraph1 = document.add_paragraph('text') # create new paragraph

comment = paragraph.add_comment('comment',author='Obay Daba',initials= 'od') # add a comment on the entire paragraph

paragraph2 = document.add_paragraph('text') # create another paragraph

run = paragraph2.add_run('texty') add a run to the paragraph

run.add_comment('comment') # add a comment only for the run text

paragraph.add_footnote('footnote text') # add a footnote



License


`MIT <https://choosealicense.com/licenses/mit/>`_
266 changes: 13 additions & 253 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,264 +1,24 @@
.. :changelog:

Release History
---------------

0.8.10 (2019-01-08)
+++++++++++++++++++
#Release History BayooG/bayoo-docx forked from (python-openxmm/python-docx)

- Revert use of expanded package directory for default.docx to work around setup.py
problem with filenames containing square brackets.

0.2.8 (2020-05-02)

0.8.9 (2019-01-08)
++++++++++++++++++
- add comments implementation on a run level
- fix issue with comments date (comments dates are set to current date)

- Fix gap in MANIFEST.in that excluded default document template directory

0.2.4 (2019-9-4)

0.8.8 (2019-01-07)
++++++++++++++++++
- loop over all the document chieldern (Paragraphs, Tables, Sections) with the right order `document.elements`
- addons to Paragraph Object (delete, heading_level, merge_paragraph )
- Add low-level implementation for comments part
- Add oxml element for <w:comments> element and sub-elements
- Add add_comment() method for docx.text.Paragraph
- Add low-level implementation for footnotes part
- Add oxml element for <w:footnotes> element and sub-elements
- Add add_footnote() method for docx.text.Paragraph

- Add support for headers and footers


0.8.7 (2018-08-18)
++++++++++++++++++

- Add _Row.height_rule
- Add _Row.height
- Add _Cell.vertical_alignment
- Fix #455: increment next_id, don't fill gaps
- Add #375: import docx failure on --OO optimization
- Add #254: remove default zoom percentage
- Add #266: miscellaneous documentation fixes
- Add #175: refine MANIFEST.ini
- Add #168: Unicode error on core-props in Python 2


0.8.6 (2016-06-22)
++++++++++++++++++

- Add #257: add Font.highlight_color
- Add #261: add ParagraphFormat.tab_stops
- Add #303: disallow XML entity expansion


0.8.5 (2015-02-21)
++++++++++++++++++

- Fix #149: KeyError on Document.add_table()
- Fix #78: feature: add_table() sets cell widths
- Add #106: feature: Table.direction (i.e. right-to-left)
- Add #102: feature: add CT_Row.trPr


0.8.4 (2015-02-20)
++++++++++++++++++

- Fix #151: tests won't run on PyPI distribution
- Fix #124: default to inches on no TIFF resolution unit


0.8.3 (2015-02-19)
++++++++++++++++++

- Add #121, #135, #139: feature: Font.color


0.8.2 (2015-02-16)
++++++++++++++++++

- Fix #94: picture prints at wrong size when scaled
- Extract `docx.document.Document` object from `DocumentPart`

Refactor `docx.Document` from an object into a factory function for new
`docx.document.Document object`. Extract methods from prior `docx.Document`
and `docx.parts.document.DocumentPart` to form the new API class and retire
`docx.Document` class.

- Migrate `Document.numbering_part` to `DocumentPart.numbering_part`. The
`numbering_part` property is not part of the published API and is an
interim internal feature to be replaced in a future release, perhaps with
something like `Document.numbering_definitions`. In the meantime, it can
now be accessed using ``Document.part.numbering_part``.


0.8.1 (2015-02-10)
++++++++++++++++++

- Fix #140: Warning triggered on Document.add_heading/table()


0.8.0 (2015-02-08)
++++++++++++++++++

- Add styles. Provides general capability to access and manipulate paragraph,
character, and table styles.

- Add ParagraphFormat object, accessible on Paragraph.paragraph_format, and
providing the following paragraph formatting properties:

+ paragraph alignment (justfification)
+ space before and after paragraph
+ line spacing
+ indentation
+ keep together, keep with next, page break before, and widow control

- Add Font object, accessible on Run.font, providing character-level
formatting including:

+ typeface (e.g. 'Arial')
+ point size
+ underline
+ italic
+ bold
+ superscript and subscript

The following issues were retired:

- Add feature #56: superscript/subscript
- Add feature #67: lookup style by UI name
- Add feature #98: Paragraph indentation
- Add feature #120: Document.styles

**Backward incompatibilities**

Paragraph.style now returns a Style object. Previously it returned the style
name as a string. The name can now be retrieved using the Style.name
property, for example, `paragraph.style.name`.


0.7.6 (2014-12-14)
++++++++++++++++++

- Add feature #69: Table.alignment
- Add feature #29: Document.core_properties


0.7.5 (2014-11-29)
++++++++++++++++++

- Add feature #65: _Cell.merge()


0.7.4 (2014-07-18)
++++++++++++++++++

- Add feature #45: _Cell.add_table()
- Add feature #76: _Cell.add_paragraph()
- Add _Cell.tables property (read-only)


0.7.3 (2014-07-14)
++++++++++++++++++

- Add Table.autofit
- Add feature #46: _Cell.width


0.7.2 (2014-07-13)
++++++++++++++++++

- Fix: Word does not interpret <w:cr/> as line feed


0.7.1 (2014-07-11)
++++++++++++++++++

- Add feature #14: Run.add_picture()


0.7.0 (2014-06-27)
++++++++++++++++++

- Add feature #68: Paragraph.insert_paragraph_before()
- Add feature #51: Paragraph.alignment (read/write)
- Add feature #61: Paragraph.text setter
- Add feature #58: Run.add_tab()
- Add feature #70: Run.clear()
- Add feature #60: Run.text setter
- Add feature #39: Run.text and Paragraph.text interpret '\n' and '\t' chars


0.6.0 (2014-06-22)
++++++++++++++++++

- Add feature #15: section page size
- Add feature #66: add section
- Add page margins and page orientation properties on Section
- Major refactoring of oxml layer


0.5.3 (2014-05-10)
++++++++++++++++++

- Add feature #19: Run.underline property


0.5.2 (2014-05-06)
++++++++++++++++++

- Add feature #17: character style


0.5.1 (2014-04-02)
++++++++++++++++++

- Fix issue #23, `Document.add_picture()` raises ValueError when document
contains VML drawing.


0.5.0 (2014-03-02)
++++++++++++++++++

- Add 20 tri-state properties on Run, including all-caps, double-strike,
hidden, shadow, small-caps, and 15 others.


0.4.0 (2014-03-01)
++++++++++++++++++

- Advance from alpha to beta status.
- Add pure-python image header parsing; drop Pillow dependency


0.3.0a5 (2014-01-10)
++++++++++++++++++++++

- Hotfix: issue #4, Document.add_picture() fails on second and subsequent
images.


0.3.0a4 (2014-01-07)
++++++++++++++++++++++

- Complete Python 3 support, tested on Python 3.3


0.3.0a3 (2014-01-06)
++++++++++++++++++++++

- Fix setup.py error on some Windows installs


0.3.0a1 (2014-01-05)
++++++++++++++++++++++

- Full object-oriented rewrite
- Feature-parity with prior version
- text: add paragraph, run, text, bold, italic
- table: add table, add row, add column
- styles: specify style for paragraph, table
- picture: add inline picture, auto-scaling
- breaks: add page break
- tests: full pytest and behave-based 2-layer test suite


0.3.0dev1 (2013-12-14)
++++++++++++++++++++++

- Round-trip .docx file, preserving all parts and relationships
- Load default "template" .docx on open with no filename
- Open from stream and save to stream (file-like object)
- Add paragraph at and of document
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
The MIT License (MIT)
Copyright (c) 2013 Steve Canny, https://github.com/scanny
Copyright (c) 2019 Obay Daba, https://github.com/bayoog
forked from https://github.com/python-openxml/python-docx

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading