Skip to content
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

'_Paragraph' object has no attribute 'bullet' #48

Open
Xwxhwy opened this issue Feb 25, 2025 · 0 comments
Open

'_Paragraph' object has no attribute 'bullet' #48

Xwxhwy opened this issue Feb 25, 2025 · 0 comments

Comments

@Xwxhwy
Copy link

Xwxhwy commented Feb 25, 2025

class Paragraph in presentation could'n been used, there has a wrong:'_Paragraph' object has no attribute 'bullet'.

my run_demo is:
`from utils import *
from pptx import Presentation
from pptx.text.text import Font
from presentation import Paragraph,StyleArg
prs = Presentation("/Users/meiguihua/Documents/组会汇报/try1.pptx")

2. 获取第一页幻灯片的第一个文本框

slide = prs.slides[0]
textbox = next(shape for shape in slide.shapes if shape.has_text_frame)

3. 处理第一个段落

paragraph = textbox.text_frame.paragraphs[0]
para_obj = Paragraph(paragraph=paragraph, idx=0) # idx为段落序号
style_args = StyleArg(
paragraph_id=True, # 是否显示段落ID
element_id=True, # 是否显示元素ID
font_style=True, # 是否保留字体样式
)
html_output = para_obj.to_html(style_args)
print("生成的HTML:\n", html_output)`

@Xwxhwy Xwxhwy closed this as completed Feb 25, 2025
@Xwxhwy Xwxhwy reopened this Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant