Comments (3)
I would. Needs to have tests though. The ones for Run.add_break()
should be good models:
- acceptance test for add_break() (one scenario should be enough)
- The steps for the add_break() acceptance test should be very similar, I think it's just three or four of those.
- This single unit test for add_break() should be a good model, along with its fixture further down in the file. It might not need any parameters. Break did because there are several different types of break.
Let me know if you need help getting started with the testing. I've been meaning to document it better, just haven't gotten to it yet.
Pull needs to be on a distinct new branch on your fork. feature/run-add-picture
let's say. You should expect that you'll need to make adjustments based on feedback to your initial pull request. Once or twice should do it :) Those changes should be in the same commits so you should be familiar with rebasing. The acceptance test should be in the first commit, by itself. Then one commit for each test/code pair. Maybe only one of those for this, we'll have to see how it goes :)
Interface should model docx.api.Document.add_picture(), i.e. image descriptor can be path or file-like object and dimensions can be specified, defaulted, or scaled on width or height. You should be able to get that from add_picture() by copy and paste. Shame on me for not factoring that bit out into a separate method somewhere, I'll clean that up later.
Let me know if you have any questions on the specifics :)
from python-docx.
Analysis notes
Need access to the part in order to create the relationship to the image part. This implies that Run, Paragraph, Body, Table, Row, Col, and Cell all need Parented as a base class.
from python-docx.
feature Run.add_picture() added in release 0.7.1 today.
from python-docx.
Related Issues (20)
- 打开空的docx文档时报错
- Inline support for SVG file stream HOT 3
- How to add internal top and bottom table cell spacings?
- Inserting a new page before last page in the word document using python HOT 1
- Auto refresh Table of Contents using docx HOT 1
- OSS-Fuzz Integration
- Highlight certain words of a paragraph to bold HOT 1
- Paragraphs/Numbering in Table of Contents Document Regions HOT 3
- no read apis HOT 1
- feat: distinguish "no such file" from "not a ZIP"
- Workaround to set <w:bidi/> property on a paragraph's properties <w:pPr>? HOT 2
- docx2pdf issue HOT 1
- Python-docx detects a single paragraph with a single run with a single style -- when it should detect multiple paragraphs each having their own style HOT 9
- How do I add an xml object by coordinates?
- Values in tables are being splitted into multiple rows if there is \n in them HOT 2
- easily replacing / removing&adding image or text in header HOT 2
- support for Text Form Fields and Checkboxes
- Setting placeholder text in list of tables via field code 'TOC \\h \\z \\c "Table"'
- custom_xml_parts not available on Linux HOT 1
- Autoescape should be TRUE by default HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-docx.