Comments (3)
from odf.opendocument import OpenDocumentText, OpenDocumentDrawing
from odf.draw import Frame, Image, Page
from odf.style import PageLayout, MasterPage, Header, Footer
from odf.text import P
from odf import table
from datetime import datetime
textdoc = OpenDocumentText()
p = P()
textdoc.text.addElement(p)
photoframe = Frame(width="200pt", height="200pt", x="56pt", y="56pt", anchortype="paragraph")
href = textdoc.addPicture('test.png')
photoframe.addElement(Image(href=href))
p.addElement(photoframe)
textdoc.save("pic.odt")
from odfpy.
With anchortype = "page"
from odf.opendocument import OpenDocumentText
from odf.draw import Frame, Image
from odf.style import Style, GraphicProperties
textdoc = OpenDocumentText()
frstyle = Style(name = 'frstyle', parentstylename="Graphics", family="graphic")
frstyle.addElement(GraphicProperties(verticalpos="from-top", verticalrel="page", horizontalpos="from-left", horizontalrel="page"))
textdoc.automaticstyles.addElement(frstyle)
photoframe = Frame(width="200pt", height="200pt", x="8cm", y="10cm", anchortype="page", stylename = frstyle)
href = textdoc.addPicture('test.png')
photoframe.addElement(Image(href=href))
textdoc.text.addElement(photoframe)
textdoc.save("pic.odt")
from odfpy.
I have the same problem.
from odfpy.
Related Issues (20)
- What is my mistake with ChangedRegion ? HOT 1
- how to clear old_document content?
- Table of contents HOT 1
- TypeError while height and width while defining the frame
- document on write formula with fraction/integral/matrix/... ?
- Automaticstyle not added into content xml HOT 1
- Linebreaks not picked up HOT 5
- Wrong AttributeError in setAttribute due to removing hyphens from attribute names HOT 1
- Cloning Subtrees
- clonespannedcolumns should not be in examples
- Iterate on All P forget Header paragraph
- Improve README.md with project status HOT 13
- How to create a table in a Text document? HOT 7
- Lost the numbers
- Would you release 1.4.2 version to pypi ? HOT 1
- ODF2XHTML throws an error if the document has a footnote or endnote in it
- Replace text
- Is there a way to generate the page breaks in an odt without having to open it manually first?
- Reverse Engineering Question HOT 1
- Open encrypted files 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 odfpy.