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

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

Already on GitHub?Sign in to your account

Open
BayooG wants to merge118 commits intopython-openxml:master
base:master
Choose a base branch
Loading
fromBayooG:master

Conversation

BayooG
Copy link

created two new parts for 'comments part' & 'footnotes part'
and now these parts can be accessed from the 'document part'
added new methods to the paragraph element so comments and footnote can be added easily

@leyiwang
Copy link

@BayooG It's cool to improve docx package to support comments. I wonder if this part of the work has been implemented and I can't wait to know how to add a comment in a docx using this package, can you give an example?

fgriberi reacted with thumbs up emoji

@BayooG
Copy link
Author

@BayooG It's cool to improve docx package to support comments. I wonder if this part of the work has been implemented and I can't wait to know how to add a comment in a docx using this package, can you give an example?

Now you can add a comment for a certain paragraph
I added a method todocx.text.paragraphadd_comment
Ex:
d = docx.Document()
p = d.add_paragraph(‘paragraph ‘)
c = p.add_comment(‘comment’)

Check my branch for more details
https://github.com/BayooG/bayoo-docx/tree/release/0.1.3

leyiwang, vincestorm, and floyddcn reacted with thumbs up emoji

@BayooG
Copy link
Author

@scanny
is there any template for contribution, or what should I do to contribute?

@Barsovski
Copy link

Barsovski commentedMar 18, 2021
edited
Loading

@BayooG good work on footnotes! But how can i change a footnote style like line_spacing and oth?
Tried this code:

f = row.cells[0].paragraphs[0].add_footnote('text')
f_format = f.paragraph.paragraph_format
f_format.space_before = Cm(0)
f_format.space_after = Cm(0)
f_format.line_spacing = Cm(0)

But in the final document there is a big indentation between footnote lines( like second empty line, and they occupy a lot of space on page.

zenko1987 reacted with eyes emoji

@verydemo
Copy link

verydemo commentedJul 14, 2021
edited
Loading

hello, Can I add comments in a word?
document.paragraphs[27].get_range(8,12).add_comment("hello comment")
The paragraph is offset (8, 12), I think in paragraphs, run should have a get_range method.

125562045-a45b5cd8-b3f6-47fa-9101-451a1bc60f77

python-docx add comment smallest object is run, MS add comment smallest object is any content .

@cnhuijiang
Copy link

May i ask if we can add footnotes on the run level now?

@floyddcn
Copy link

@BayooG It's cool to improve docx package to support comments. I wonder if this part of the work has been implemented and I can't wait to know how to add a comment in a docx using this package, can you give an example?

Now you can add a comment for a certain paragraph I added a method todocx.text.paragraphadd_comment Ex: d = docx.Document() p = d.add_paragraph(‘paragraph ‘) c = p.add_comment(‘comment’)

Check my branch for more detailshttps://github.com/BayooG/bayoo-docx/tree/release/0.1.3

work consider giving it a star
@BayooG
Splendid work!!! I checked the bayoo-docx and find it can write and retrieve comment well.
But i don't know how to write and retrieve comments across paragraphs or in cells(which i think is the same as 'across paragraphs' because under cells are lots of paragraphs).
If the 'comments across paragraphs' is not available yet ,is there any plan to support it in the future?

@sherrysdavis
Copy link

EndNote Full Torrent does as many tasks as possible automatically. As an example, it is able to automatically format and update bibliographies, for example
EndNote

ahmadalwarehand others added7 commitsOctober 31, 2022 21:10
* Update version* reverse version to origin* Add add_ole_object_to_run func
* Update version* reverse version to origin* Add add_ole_object_to_run func* Update README* Update README* Update README* Update README
* Update version* reverse version to origin* Add add_ole_object_to_run func* Update README* Update README* Update README* Update README* Add fldChar element support* Add instrText  element support* Set instr_text element as a property* Set instr_text element delete* Avoid duplication if add instrtext element with run already has

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?

@Cayllen
Copy link

Cayllen commentedMar 27, 2024
edited
Loading

Awesome work@BayooG ! Shame it's not merged yet. How would it be possible to span a comment across multiple paragraphs with this implementation?

@bhavasagar-dv
Copy link

@scanny can we know if this PR will be merged ?

sagzest, adrian-chen, zw00sh, and neilrathi01 reacted with thumbs up emoji

@rodolvbg
Copy link

rodolvbg commentedJun 4, 2024
edited
Loading

Hi,@BayooG, could you leave a simple solution to add a footnote, as long as this PR does not merge? BTW, nice job

@BayooG
Copy link
Author

Hi,@BayooG, could you leave a simple solution to add a footnote, as long as this PR does not merge? BTW, nice job

I have a fork, check thishttps://github.com/BayooG/bayoo-docx

@wschlecht
Copy link

I really appreciate this fork@BayooG, being able to add comments is a HUGE plus when programmatically generating documents (e.g., flagging which sections of a document were written by an LLM so a human can follow up and review those sections). I only see the need for this functionality increasing, and really hope to see this feature integrated into the main python-docx branch (@scanny)

@Cerebex
Copy link

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

DSLituiev, chenj-WUST, and didmar reacted with thumbs up emojiDSLituiev reacted with eyes emoji

@beguelucas
Copy link

beguelucas commentedNov 4, 2024
edited
Loading

does this feature of adding comments include adding hyperlinks inside comments?

i am currently using this approach to add hyperlinks to a run, which i took it from another github issue:

def add_hyperlink_into_run(    paragraph: Paragraph,    run: Run,    url: str,) -> None:    runs = paragraph.runs    for i in range(len(runs)):        if runs[i].text == run.text:            break    # --- This gets access to the document.xml.rels file and gets a new relation id value ---    part = paragraph.part  # type: ignore    r_id = part.relate_to(  # type: ignore        url,        RELATIONSHIP_TYPE.HYPERLINK,        is_external=True,    )    # --- Create the w:hyperlink tag and add needed values ---    hyperlink = docx.oxml.shared.OxmlElement("w:hyperlink")  # type: ignore    hyperlink.set(  # type: ignore        qn("r:id"),        r_id,    )    hyperlink.append(run._r)  # type: ignore    paragraph._p.insert(i, hyperlink)  # type: ignore

does anyone have an insight on how to add a hyperlink to a subtring inside a comment created with bayoo-docx?

KenWuqianghao reacted with eyes emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@manolisfcbmanolisfcbmanolisfcb left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

24 participants
@BayooG@leyiwang@CaseGuide@nitinkhosla79@jakepoz@jceresearch@sanyoggupta@aseifert@br-rkdrnf@Gqia189@Barsovski@verydemo@cnhuijiang@floyddcn@sherrysdavis@Cayllen@bhavasagar-dv@rodolvbg@wschlecht@Cerebex@beguelucas@manolisfcb@lone-bassel@ahmadalwareh

[8]ページ先頭

©2009-2025 Movatter.jp