Reference
AnimPar
Bases: Element
A container for SMIL Presentation Animations.
Arguments:
presentation_node_type -- default, on-click, with-previous,
after-previous, timing-root, main-sequence
and interactive-sequence
smil_begin -- indefinite, 10s, [id].click, [id].begin
Source code in odfdo/smil.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
AnimSeq
Bases: Element
TA container for SMIL Presentation Animations. Animations inside this block are executed after the slide has executed its initial transition.
Arguments:
presentation_node_type -- default, on-click, with-previous,
after-previous, timing-root, main-sequence
and interactive-sequence
Source code in odfdo/smil.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
AnimTransFilter
Bases: Element
Class to make a beautiful transition between two frames.
Arguments:
smil_dur – str, duration
smil_type and smil_subtype – see http://www.w3.org/TR/SMIL20/ smil-transitions.html#TransitionEffects-Appendix to get a list of all types/subtypes
smil_direction – forward, reverse
smil_fadeColor – forward, reverse
smil_mode – in, out
Source code in odfdo/smil.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
Annotation
Bases: MDTail
, Element
, DcCreatorMixin
, DcDateMixin
Annotation element credited to the given creator with the given text, optionally dated (current date by default). If name not provided and some parent is provided, the name is autogenerated.
Arguments:
text -- str or odf_element
creator -- str
date -- datetime
name -- str
parent -- Element
Source code in odfdo/note.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
|
dc_creator
property
writable
Alias for self.creator property.
dc_date
property
writable
Alias for self.date property.
end
property
Return the corresponding annotation-end tag or None.
start
property
Return self.
delete(child=None, keep_tail=True)
Delete the given element from the XML tree. If no element is given, “self” is deleted. The XML library may allow to continue to use an element now “orphan” as long as you have a reference to it.
For Annotation : delete the annotation-end tag if exists.
Arguments:
child -- Element or None
Source code in odfdo/note.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
get_annotated(as_text=False, no_header=True, clean=True)
Returns the annotated content from an annotation.
If no content exists (single position annotation or annotation-end not found), returns [] (or “” if text flag is True). If as_text is True: returns the text content. If clean is True: suppress unwanted tags (deletions marks, …) If no_header is True: existing text:h are changed in text:p By default: returns a list of odf_element, cleaned and without headers.
Arguments:
as_text -- boolean
clean -- boolean
no_header -- boolean
Return: list or Element or text or None
Source code in odfdo/note.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
|
AnnotationEnd
Bases: MDTail
, Element
AnnotationEnd: the “office:annotation-end” element may be used to define the end of a text range of document content that spans element boundaries. In that case, an “office:annotation” element shall precede the “office:annotation-end” element. Both elements shall have the same value for their office:name attribute. The “office:annotation-end” element shall be preceded by an “office:annotation” element that has the same value for its office:name attribute as the “office:annotation-end” element. An “office:annotation-end” element without a preceding “office:annotation” element that has the same name assigned is ignored.
Source code in odfdo/note.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
|
end
property
Return self.
start
property
Return the corresponding annotation starting tag or None.
__init__(annotation=None, name=None, **kwargs)
Initialize an AnnotationEnd element. Either annotation or name must be provided to have proper reference for the annotation-end.
Arguments:
annotation -- odf_annotation element
name -- str
Source code in odfdo/note.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
|
Body
Bases: Element
Body, specialized class of Element in charge of actual content management.
Source code in odfdo/body.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
tables
property
Return all the tables.
Return: list of Table
get_table(position=0, name=None, content=None)
Return the table that matches the criteria.
Arguments:
position -- int
name -- str
content -- str regex
Return: Table or None if not found
Source code in odfdo/body.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
get_tables(style=None, content=None)
Return all the tables that match the criteria.
Arguments:
style -- str
content -- str regex
Return: list of Table
Source code in odfdo/body.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
Bookmark
Bases: Element
Bookmark class for ODF “text:bookmark”
Arguments:
name -- str
Source code in odfdo/bookmark.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
BookmarkEnd
Bases: Element
BookmarkEnd class for ODF “text:bookmark-end”
Arguments:
name -- str
Source code in odfdo/bookmark.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
BookmarkStart
Bases: Element
BookmarkStart class for ODF “text:bookmark-start”
Arguments:
name -- str
Source code in odfdo/bookmark.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
Cell
Bases: ElementTyped
“table:table-cell” table cell element.
Source code in odfdo/cell.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
|
bool
property
writable
Set / get the value of the cell as a boolean.
currency
property
writable
Get / set the currency used for monetary values.
Return: str | None
date
property
writable
Set / get the value of the cell as a date.
datetime
property
writable
Set / get the value of the cell as a datetime.
decimal
property
writable
Set / get the value of the cell as a Decimal (or 0.0).
duration
property
writable
Set / get the value of the cell as a duration (Python timedelta).
float
property
writable
Set / get the value of the cell as a float (or 0.0).
formula
property
writable
Get / set the formula of the cell, or None if undefined.
The formula is not interpreted in any way.
Return: str | None
int
property
writable
Set / get the value of the cell as a integer (or 0).
repeated
property
writable
Get / set the number of times the cell is repeated.
Always None when using the table API.
Return: int or None
string
property
writable
Set / get the value of the cell as a string (or ‘’).
style
property
writable
Get / set the style of the cell itself.
Return: str | None
type
property
writable
Get / set the type of the cell: boolean, float, date, string or time.
Return: str | None
value
property
writable
Set / get the value of the cell. The type is read from the ‘office:value-type’ attribute of the cell. When setting the value, the type of the value will determine the new value_type of the cell.
Warning
- for date, datetime and timedelta, a default text value is generated.
- for boolean type, the text value is either ‘True’ or ‘False’.
- for numeric types, the return value is either Decimal or in, use the float, decimal or int properties to force the type.
- Use the method Cell.set_value() to customize the text value.
__init__(value=None, text=None, cell_type=None, currency=None, formula=None, repeated=None, style=None, **kwargs)
Create a cell element containing the given value. The textual representation is automatically formatted but can be provided. Cell type can be deduced as well, unless the number is a percentage or currency. If cell type is “currency”, the currency must be given. The cell can be repeated on the given number of columns.
Arguments:
value -- bool, int, float, Decimal, date, datetime, str,
timedelta
text -- str
cell_type -- 'boolean', 'currency', 'date', 'float', 'percentage',
'string' or 'time'
currency -- three-letter str
repeated -- int
style -- str
Source code in odfdo/cell.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
is_empty(aggressive=False)
Return whether the cell has no value or the value evaluates to False (empty string), and no style.
If aggressive is True, empty cells with style are considered empty.
Arguments:
aggressive -- bool
Return: bool
Source code in odfdo/cell.py
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
|
is_spanned()
Return whether the cell is spanned over several cells.
Returns: True | False
Source code in odfdo/cell.py
512 513 514 515 516 517 518 519 520 521 522 523 |
|
set_value(value, text=None, cell_type=None, currency=None, formula=None)
Set the cell state from the Python value type.
Text is how the cell is displayed. Cell type is guessed, unless provided.
For monetary values, provide the name of the currency.
Arguments:
value -- Python type
text -- str
cell_type -- 'boolean', 'float', 'date', 'string', 'time',
'currency' or 'percentage'
currency -- str
Source code in odfdo/cell.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
|
ChangeInfo
Bases: Element
, DcCreatorMixin
, DcDateMixin
The “office:change-info” element represents who made a change and when. It may also contain a comment (one or more Paragrah “text:p” elements) on the change.
Source code in odfdo/tracked_changes.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
get_comments(joined=True)
Get text content of the comments. If joined is True (default), the text of different paragraphs is concatenated, else a list of strings, one per paragraph, is returned.
Arguments:
joined -- boolean (default is True)
Return: str or list of str.
Source code in odfdo/tracked_changes.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
set_comments(text='', replace=True)
Set the text content of the comments. If replace is True (default), the new text replace old comments, else it is added at the end.
Arguments:
text -- str
replace -- boolean
Source code in odfdo/tracked_changes.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
Chart
Bases: Body
Chart, specialized class of Element in charge of actual content management.
Source code in odfdo/body.py
92 93 94 95 96 97 98 |
|
Column
Bases: Element
ODF table column “table:table-column”
Source code in odfdo/table.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
|
default_cell_style
property
writable
Get or set the default cell style for column.
repeated
property
writable
Get /set the number of times the column is repeated.
Always None when using the table API.
Return: int or None
style
property
writable
Get /set the style of the column itself.
Return: str
__init__(default_cell_style=None, repeated=None, style=None, **kwargs)
Create a column group element of the optionally given style. Cell style can be set for the whole column. If the properties apply to several columns, give the number of repeated columns.
Columns don’t contain cells, just style information.
You don’t generally have to create columns by hand, use the Table API.
Arguments:
default_cell_style -- str
repeated -- int
style -- str
Source code in odfdo/table.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
get_default_cell_style()
Get or set the default cell style for column.
(See also self.default_cell_style property.)
Source code in odfdo/table.py
223 224 225 226 227 228 |
|
set_default_cell_style(style)
Get or set the default cell style for column.
(See also self.default_cell_style property.)
Source code in odfdo/table.py
230 231 232 233 234 235 |
|
ConnectorShape
Bases: ShapeBase
Create a Connector shape.
Arguments:
style -- str
text_style -- str
draw_id -- str
layer -- str
connected_shapes -- (shape, shape)
glue_points -- (point, point)
p1 -- (str, str)
p2 -- (str, str)
Source code in odfdo/shapes.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
|
Container
Representation of the ODF file.
Source code in odfdo/container.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
|
clone
property
Make a copy of this container with no path.
mimetype
property
writable
Return str value of mimetype of the document.
parts
property
Get the list of members.
del_part(path)
Mark a part for deletion.
Source code in odfdo/container.py
604 605 606 |
|
get_part(path)
Get the bytes of a part of the ODF.
Source code in odfdo/container.py
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
|
get_parts()
Get the list of members.
Source code in odfdo/container.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
|
open(path_or_file)
Load the content of an ODF file.
Source code in odfdo/container.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
save(target, packaging=None, backup=False, pretty=False)
Save the container to the given target, a path or a file-like object.
Package the output document in the same format than current document, unless “packaging” is different.
Arguments:
target -- str or file-like or Path
packaging -- 'zip', or for debugging purpose 'xml' or 'folder'
backup -- boolean
Source code in odfdo/container.py
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
|
set_part(path, data)
Replace or add a new part.
Source code in odfdo/container.py
600 601 602 |
|
Content
Bases: XmlPart
Source code in odfdo/content.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
get_style(family, name_or_element=None, display_name=None)
Return the style uniquely identified by the name/family pair. If the argument is already a style object, it will return it.
If the name is None, the default style is fetched.
If the name is not the internal name but the name you gave in the desktop application, use display_name instead.
Arguments:
family -- 'paragraph', 'text', 'graphic', 'table', 'list',
'number', ...
name_or_element -- str or Style
display_name -- str
Return: Style or None if not found
Source code in odfdo/content.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
get_styles(family=None)
Return the list of styles in the Content part, optionally limited to the given family.
Arguments:
family -- str or None
Return: list of Style
Source code in odfdo/content.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
Database
Bases: Body
Database, specialized class of Element in charge of actual content management.
Source code in odfdo/body.py
101 102 103 104 105 106 107 |
|
Document
Bases: MDDocument
Abstraction of the ODF document.
To create a new Document, several possibilities:
- Document() or Document("text") or Document("odt")
-> an "empty" document of type text
- Document("spreadsheet") or Document("ods")
-> an "empty" document of type spreadsheet
- Document("presentation") or Document("odp")
-> an "empty" document of type presentation
- Document("drawing") or Document("odg")
-> an "empty" document of type drawing
Meaning of “empty”: these documents are copies of the default
templates documents provided with this library, which, as templates,
are not really empty. It may be useful to clear the newly created
document: document.body.clear(), or adjust meta informations like
description or default language: document.meta.language = 'fr-FR'
If the argument is not a known template type, or is a Path, Document(file) will load the content of the ODF file.
To explicitly create a document from a custom template, use the Document.new(path) method whose argument is the path to the template file.
Source code in odfdo/document.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 |
|
body
property
Return the body element of the content part, where actual content is stored.
clone
property
Return an exact copy of the document.
Return: Document
manifest
property
Return the manifest part (manifest.xml) of the document.
meta
property
Return the meta part (meta.xml) of the document, where meta data are stored.
parts
property
Return available part names with path inside the archive, e.g. [‘content.xml’, …, ‘Pictures/100000000000032000000258912EB1C3.jpg’]
path
property
writable
Shortcut to Document.Container.path.
add_file(path_or_file)
Insert a file from a path or a file-like object in the container.
Return the full path to reference in the content. The internal name of the file in the Picture/ folder is gnerated by a hash function.
Arguments:
path_or_file -- str or Path or file-like
Return: str (URI)
Source code in odfdo/document.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
|
add_page_break_style()
Ensure that the document contains the style required for a manual page break.
Then a manual page break can be added to the document with
from paragraph import PageBreak … document.body.append(PageBreak())
Note: this style uses the property ‘fo:break-after’, another possibility could be the property ‘fo:break-before’
Source code in odfdo/document.py
1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 |
|
del_part(path)
Mark a part for deletion. The path is relative to the archive, e.g. “Pictures/1003200258912EB1C3.jpg”
Source code in odfdo/document.py
366 367 368 369 370 371 372 373 374 375 376 |
|
delete_styles()
Remove all style information from content and all styles.
Return: number of deleted styles
Source code in odfdo/document.py
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 |
|
get_cell_background_color(table, coord, default='#ffffff')
Return the background color of a table cell of a .ods document, from the cell style, or from the row or column.
If color is not defined, return default value..
Source code in odfdo/document.py
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 |
|
get_cell_style_properties(table, coord)
Return the style properties of a table cell of a .ods document, from the cell style or from the row style.
Source code in odfdo/document.py
1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 |
|
get_formated_meta()
Return meta informations as text, with some formatting.
(Redirection to new implementation for compatibility.)
Source code in odfdo/document.py
553 554 555 556 557 |
|
get_formatted_text(rst_mode=False)
Return content as text, with some formatting.
Source code in odfdo/document.py
503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
|
get_part(path)
Return the bytes of the given part. The path is relative to the archive, e.g. “Pictures/1003200258912EB1C3.jpg”.
‘content’, ‘meta’, ‘settings’, ‘styles’ and ‘manifest’ are shortcuts to the real path, e.g. content.xml, and return a dedicated object with its own API.
path formated as URI, so always use ‘/’ separator
Source code in odfdo/document.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
|
get_parts()
Return available part names with path inside the archive, e.g. [‘content.xml’, …, ‘Pictures/100000000000032000000258912EB1C3.jpg’]
Source code in odfdo/document.py
308 309 310 311 312 313 314 |
|
get_style(family, name_or_element=None, display_name=None)
Return the style uniquely identified by the name/family pair. If the argument is already a style object, it will return it.
If the name is None, the default style is fetched.
If the name is not the internal name but the name you gave in a desktop application, use display_name instead.
Arguments:
family -- 'paragraph', 'text', 'graphic', 'table', 'list',
'number', 'page-layout', 'master-page', ...
name -- str or Element or None
display_name -- str
Return: Style or None if not found.
Source code in odfdo/document.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 |
|
get_style_properties(family, name, area=None)
Return the properties of the required style as a dict.
Source code in odfdo/document.py
1180 1181 1182 1183 1184 1185 1186 1187 |
|
get_styled_elements(name='')
Brute-force to find paragraphs, tables, etc. using the given style name (or all by default).
Arguments:
name -- str
Return: list
Source code in odfdo/document.py
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 |
|
get_table_displayed(table)
Return the table:display property of the style of the table, ie if the table should be displayed in a graphical interface.
Note: that method replaces the broken Table.displayd() method from previous odfdo versions.
Arguments:
table -- name or index of the table
Source code in odfdo/document.py
1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 |
|
get_table_style(table)
Return the Style instance the table.
Arguments:
table -- name or index of the table
Source code in odfdo/document.py
1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 |
|
get_type()
Get the ODF type (also called class) of this document.
‘chart’, ‘database’, ‘formula’, ‘graphics’,
‘graphics-template’, ‘image’, ‘presentation’, ‘presentation-template’, ‘spreadsheet’, ‘spreadsheet-template’, ‘text’, ‘text-master’, ‘text-template’ or ‘text-web’
Source code in odfdo/document.py
390 391 392 393 394 395 396 397 398 399 400 401 402 |
|
insert_style(style, name='', automatic=False, default=False)
Insert the given style object in the document, as required by the style family and type.
The style is expected to be a common style with a name. In case it was created with no name, the given can be set on the fly.
If automatic is True, the style will be inserted as an automatic style.
If default is True, the style will be inserted as a default style and would replace any existing default style of the same family. Any name or display name would be ignored.
Automatic and default arguments are mutually exclusive.
All styles can’t be used as default styles. Default styles are allowed for the following families: paragraph, text, section, table, table-column, table-row, table-cell, table-page, chart, drawing-page, graphic, presentation, control and ruby.
Arguments:
style -- Style or str
name -- str
automatic -- bool
default -- bool
Return : style name – str
Source code in odfdo/document.py
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 |
|
merge_styles_from(document)
Copy all the styles of a document into ourself.
Styles with the same type and name will be replaced, so only unique styles will be preserved.
Source code in odfdo/document.py
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 |
|
new(template='text')
classmethod
Create a Document from a template.
The template argument is expected to be the path to a ODF template.
Arguments:
template -- str or Path or file-like (io.BytesIO)
Return : ODF document – Document
Source code in odfdo/document.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
save(target=None, packaging=ZIP, pretty=None, backup=False)
Save the document, at the same place it was opened or at the given target path. Target can also be a file-like object. It can be saved as a Zip file (default), flat XML format or as files in a folder (for debugging purpose). XML parts can be pretty printed (the default for ‘folder’ and ‘xml’ packaging).
Note: ‘xml’ packaging is an experimental work in progress.
Arguments:
target -- str or file-like object
packaging -- 'zip', 'folder', 'xml'
pretty -- bool | None
backup -- bool
Source code in odfdo/document.py
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
|
set_part(path, data)
Set the bytes of the given part. The path is relative to the archive, e.g. “Pictures/1003200258912EB1C3.jpg”.
path formated as URI, so always use ‘/’ separator
Source code in odfdo/document.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
|
set_table_displayed(table, displayed)
Set the table:display property of the style of the table, ie if the table should be displayed in a graphical interface.
Note: that method replaces the broken Table.displayd() method from previous odfdo versions.
Arguments:
table -- name or index of the table
displayed -- boolean flag
Source code in odfdo/document.py
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 |
|
DrawFillImage
Bases: DrawImage
Source code in odfdo/image.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
__init__(name=None, display_name=None, height=None, width=None, **kwargs)
The “draw:fill-image” element specifies a link to a bitmap resource. Fill image are not available as automatic styles. The “draw:fill-image” element is usable within the following element: “office:styles”
Arguments:
name -- str
display_name -- str
height -- str
width -- str
Source code in odfdo/image.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
DrawGroup
Bases: Element
, AnchorMix
, ZMix
, PosMix
The DrawGroup “draw:g” element represents a group of drawing shapes.
Warning: implementation is currently minimal.
Drawing shapes contained by a “draw:g” element that is itself contained by a “draw:a” element, act as hyperlinks using the xlink:href attribute of the containing “draw:a” element. If the included drawing shapes are themselves contained within “draw:a” elements, then the xlink:href attributes of those “draw:a” elements act as the hyperlink information for the shapes they contain.
The “draw:g” element has the following attributes: draw:caption-id, draw:class-names, draw:id, draw:name, draw:style-name, draw:z-index, presentation:class-names, presentation:style-name, svg:y, table:end-cell-address, table:end-x, table:end-y, table:table-background, text:anchor-page-number, text:anchor-type, and xml:id.
The “draw:g” element has the following child elements: “dr3d:scene”, “draw:a”, “draw:caption”, “draw:circle”, “draw:connector”, “draw:control”, “draw:custom-shape”, “draw:ellipse”, “draw:frame”, “draw:g”, “draw:glue-point”, “draw:line”, “draw:measure”, “draw:page-thumbnail”, “draw:path”, “draw:polygon”, “draw:polyline”, “draw:rect”, “draw:regular-polygon”, “office:event-listeners”, “svg:desc” and “svg:title”.
Source code in odfdo/shapes.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
|
DrawImage
Bases: Element
The “draw:image” element represents an image. An image can be either a link to an external resource or most often embedded into the document. When image is embedded in the document, the url parameter is a reference to the local document obtained by copying the source image into the document, ie: url = document.add_file(image_path)
Warning: image elements must be stored in a frame “draw:frame”, see Frame().
Source code in odfdo/image.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
__init__(url='', xlink_type='simple', show='embed', actuate='onLoad', filter_name=None, **kwargs)
Initialisation of an DrawImage.
Arguments:
url -- str
type -- str
show -- str
actuate -- str
filter_name -- str
Source code in odfdo/image.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
DrawPage
Bases: Element
ODF draw page “draw:page”, for pages of presentation and drawings.
Source code in odfdo/draw_page.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
__init__(draw_id=None, name=None, master_page=None, presentation_page_layout=None, style=None, **kwargs)
Arguments:
draw_id -- str
name -- str
master_page -- str
presentation_page_layout -- str
style -- str
Source code in odfdo/draw_page.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
Drawing
Bases: Body
Drawing, specialized class of Element in charge of actual content management.
Source code in odfdo/body.py
110 111 112 113 114 115 116 |
|
EText
Bases: str
Representation of an XML text node. Created to hide the specifics of lxml in searching text nodes using XPath.
Constructed like any str object but only accepts lxml text objects.
Source code in odfdo/element.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
|
Element
Bases: MDBase
Super class of all ODF classes.
Representation of an XML element. Abstraction of the XML library behind.
Source code in odfdo/element.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 |
|
document_body
property
Return the first children of document body if any: ‘office:body/*[1]’
frames
property
Return all the frames.
Return: list of Frame
headers
property
Return all the Headers.
Return: list of Header
images
property
Return all the images.
Return: list of Element
lists
property
Return all the lists.
Return: list of List
paragraphs
property
Return all the paragraphs.
Return: list of Paragraph
sections
property
Return all the sections.
Return: list of Element
spans
property
Return all the spans.
Return: list of Span
tag
property
writable
Get/set the underlying xml tag with the given qualified name.
Warning: direct change of tag does not change the element class.
Arguments:
qname -- str (e.g. "text:span")
tail
property
writable
Get / set the text immediately following the element.
text
property
writable
Get / set the text content of the element.
text_changes
property
Return all the text changes, either single deletion (text:change) or start of range of changes (text:change-start).
Return: list of Element
text_content
property
writable
Get / set the text of the embedded paragraphs, including embeded annotations, cells…
Set does create a paragraph if missing.
toc
property
Return the first table of contents.
Return: odf_toc or None if not found
tocs
property
Return all the tables of contents.
Return: list of odf_toc
tracked_changes
property
Return the tracked-changes part in the text body.
Return: Element or None
user_defined_list
property
Return all the user defined field declarations.
Return: list of Element
__append(str_or_element)
Insert element or text in the last position.
Source code in odfdo/element.py
1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 |
|
append_named_range(named_range)
Append the named range to the spreadsheet, replacing existing named range of same name if any.
Arguments:
named_range -- NamedRange
Source code in odfdo/element.py
2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 |
|
clear()
Remove text, children and attributes from the element.
Source code in odfdo/element.py
1665 1666 1667 |
|
delete(child=None, keep_tail=True)
Delete the given element from the XML tree. If no element is given, “self” is deleted. The XML library may allow to continue to use an element now “orphan” as long as you have a reference to it.
if keep_tail is True (default), the tail text is not erased.
Arguments:
child -- Element
keep_tail -- boolean (default to True), True for most usages.
Source code in odfdo/element.py
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 |
|
delete_named_range(name)
Delete the Named Range of specified name from the spreadsheet.
Arguments:
name -- str
Source code in odfdo/element.py
2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 |
|
elements_repeated_sequence(xpath_instance, name)
Utility method for table module.
Source code in odfdo/element.py
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 |
|
extend(odf_elements)
Fast append elements at the end of ourself using extend.
Source code in odfdo/element.py
1429 1430 1431 1432 1433 1434 |
|
from_tag(tag_or_elem)
classmethod
Element class and subclass factory.
Turn an lxml Element or ODF string tag into an ODF XML Element of the relevant class.
Arguments:
tag_or_elem -- ODF str tag or lxml.Element
Return: Element (or subclass) instance
Source code in odfdo/element.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
get_annotation(position=0, creator=None, start_date=None, end_date=None, content=None, name=None)
Return the annotation that matches the criteria.
Arguments:
position -- int
creator -- str
start_date -- datetime instance
end_date -- datetime instance
content -- str regex
name -- str
Return: Annotation or None if not found
Source code in odfdo/element.py
2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 |
|
get_annotation_end(position=0, name=None)
Return the annotation end that matches the criteria.
Arguments:
position -- int
name -- str
Return: Element or None if not found
Source code in odfdo/element.py
2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 |
|
get_annotation_ends()
Return all the annotation ends.
Return: list of Element
Source code in odfdo/element.py
2357 2358 2359 2360 2361 2362 |
|
get_annotations(creator=None, start_date=None, end_date=None, content=None)
Return all the annotations that match the criteria.
Arguments:
creator -- str
start_date -- datetime instance
end_date -- datetime instance
content -- str regex
Return: list of Annotation
Source code in odfdo/element.py
2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 |
|
get_attribute(name)
Return the attribute value as type str | bool | None.
Source code in odfdo/element.py
795 796 797 798 799 800 801 802 803 804 |
|
get_attribute_integer(name)
Return either the attribute as type int, or None.
Source code in odfdo/element.py
806 807 808 809 810 811 812 813 814 815 816 |
|
get_attribute_string(name)
Return either the attribute as type str, or None.
Source code in odfdo/element.py
818 819 820 821 822 823 824 825 |
|
get_between(tag1, tag2, as_text=False, clean=True, no_header=True)
Returns elements between tag1 and tag2, tag1 and tag2 shall be unique and having an id attribute. (WARN: buggy if tag1/tag2 defines a malformed odf xml.) If as_text is True: returns the text content. If clean is True: suppress unwanted tags (deletions marks, …) If no_header is True: existing text:h are changed in text:p By default: returns a list of Element, cleaned and without headers.
Implementation and standard retrictions: Only text:h and text:p sould be ‘cut’ by an insert tag, so inner parts of insert tags are:
- any text:h, text:p or sub tag of these
- some text, part of a parent text:h or text:p
Arguments:
tag1 -- Element
tag2 -- Element
as_text -- boolean
clean -- boolean
no_header -- boolean
Return: list of odf_paragraph or odf_header
Source code in odfdo/element.py
1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 |
|
get_bookmark(position=0, name=None)
Return the bookmark that matches the criteria.
Arguments:
position -- int
name -- str
Return: Bookmark or None if not found
Source code in odfdo/element.py
2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 |
|
get_bookmark_end(position=0, name=None)
Return the bookmark end that matches the criteria.
Arguments:
position -- int
name -- str
Return: Element or None if not found
Source code in odfdo/element.py
2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 |
|
get_bookmark_ends()
Return all the bookmark ends.
Return: list of Element
Source code in odfdo/element.py
2743 2744 2745 2746 2747 2748 |
|
get_bookmark_start(position=0, name=None)
Return the bookmark start that matches the criteria.
Arguments:
position -- int
name -- str
Return: Element or None if not found
Source code in odfdo/element.py
2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 |
|
get_bookmark_starts()
Return all the bookmark starts.
Return: list of Element
Source code in odfdo/element.py
2717 2718 2719 2720 2721 2722 |
|
get_bookmarks()
Return all the bookmarks.
Return: list of Element
Source code in odfdo/element.py
2691 2692 2693 2694 2695 2696 |
|
get_changes_ids()
Return a list of ids that refers to a change region in the tracked changes list.
Source code in odfdo/element.py
3176 3177 3178 3179 3180 3181 3182 3183 3184 |
|
get_draw_connector(position=0, id=None, content=None)
Return the draw connector that matches the criteria.
Arguments:
position -- int
id -- str
content -- str regex
Return: odf_shape or None if not found
Source code in odfdo/element.py
3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 |
|
get_draw_connectors(draw_style=None, draw_text_style=None, content=None)
Return all the draw connectors that match the criteria.
Arguments:
draw_style -- str
draw_text_style -- str
content -- str regex
Return: list of odf_shape
Source code in odfdo/element.py
3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 |
|
get_draw_ellipse(position=0, id=None, content=None)
Return the draw ellipse that matches the criteria.
Arguments:
position -- int
id -- str
content -- str regex
Return: odf_shape or None if not found
Source code in odfdo/element.py
3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 |
|
get_draw_ellipses(draw_style=None, draw_text_style=None, content=None)
Return all the draw ellipses that match the criteria.
Arguments:
draw_style -- str
draw_text_style -- str
content -- str regex
Return: list of odf_shape
Source code in odfdo/element.py
3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 |
|
get_draw_line(position=0, id=None, content=None)
Return the draw line that matches the criteria.
Arguments:
position -- int
id -- str
content -- str regex
Return: odf_shape or None if not found
Source code in odfdo/element.py
2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 |
|
get_draw_lines(draw_style=None, draw_text_style=None, content=None)
Return all the draw lines that match the criteria.
Arguments:
draw_style -- str
draw_text_style -- str
content -- str regex
Return: list of odf_shape
Source code in odfdo/element.py
2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 |
|
get_draw_page(position=0, name=None, content=None)
Return the draw page that matches the criteria.
Arguments:
position -- int
name -- str
content -- str regex
Return: DrawPage or None if not found
Source code in odfdo/element.py
2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 |
|
get_draw_pages(style=None, content=None)
Return all the draw pages that match the criteria.
Arguments:
style -- str
content -- str regex
Return: list of DrawPage
Source code in odfdo/element.py
2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 |
|
get_draw_rectangle(position=0, id=None, content=None)
Return the draw rectangle that matches the criteria.
Arguments:
position -- int
id -- str
content -- str regex
Return: odf_shape or None if not found
Source code in odfdo/element.py
3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 |
|
get_draw_rectangles(draw_style=None, draw_text_style=None, content=None)
Return all the draw rectangles that match the criteria.
Arguments:
draw_style -- str
draw_text_style -- str
content -- str regex
Return: list of odf_shape
Source code in odfdo/element.py
3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 |
|
get_formatted_text(context=None)
This function should return a beautiful version of the text.
Source code in odfdo/element.py
1703 1704 1705 |
|
get_frame(position=0, name=None, presentation_class=None, title=None, description=None, content=None)
Return the section that matches the criteria.
Arguments:
position -- int
name -- str
presentation_class -- str
title -- str regex
description -- str regex
content -- str regex
Return: Frame or None if not found
Source code in odfdo/element.py
2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 |
|
get_frames(presentation_class=None, style=None, title=None, description=None, content=None)
Return all the frames that match the criteria.
Arguments:
presentation_class -- str
style -- str
title -- str regex
description -- str regex
content -- str regex
Return: list of Frame
Source code in odfdo/element.py
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 |
|
get_header(position=0, outline_level=None, content=None)
Return the Header that matches the criteria.
Arguments:
position -- int
content -- str regex
Return: Header or None if not found
Source code in odfdo/element.py
1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 |
|
get_headers(style=None, outline_level=None, content=None)
Return all the Headers that match the criteria.
Arguments:
style -- str
content -- str regex
Return: list of Header
Source code in odfdo/element.py
1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 |
|
get_image(position=0, name=None, url=None, content=None)
Return the image matching the criteria.
Arguments:
position -- int
name -- str
url -- str regex
content -- str regex
Return: Element or None if not found
Source code in odfdo/element.py
2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 |
|
get_images(style=None, url=None, content=None)
Return all the images matching the criteria.
Arguments:
style -- str
url -- str regex
content -- str regex
Return: list of Element
Source code in odfdo/element.py
2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 |
|
get_link(position=0, name=None, title=None, url=None, content=None)
Return the link that matches the criteria.
Arguments:
position -- int
name -- str
title -- str
url -- str regex
content -- str regex
Return: Element or None if not found
Source code in odfdo/element.py
2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 |
|
get_links(name=None, title=None, url=None, content=None)
Return all the links that match the criteria.
Arguments:
name -- str
title -- str
url -- str regex
content -- str regex
Return: list of Element
Source code in odfdo/element.py
2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 |
|
get_list(position=0, content=None)
Return the list that matches the criteria.
Arguments:
position -- int
content -- str regex
Return: List or None if not found
Source code in odfdo/element.py
1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 |
|
get_lists(style=None, content=None)
Return all the lists that match the criteria.
Arguments:
style -- str
content -- str regex
Return: list of List
Source code in odfdo/element.py
1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 |
|
get_named_range(name)
Return the named range of specified name, or None if not found.
Arguments:
name -- str
Return: NamedRange
Source code in odfdo/element.py
2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 |
|
get_named_ranges()
Return all the tables named ranges.
Return: list of odf_named_range
Source code in odfdo/element.py
2157 2158 2159 2160 2161 2162 2163 2164 2165 |
|
get_note(position=0, note_id=None, note_class=None, content=None)
Return the note that matches the criteria.
Arguments:
position -- int
note_id -- str
note_class -- 'footnote' or 'endnote'
content -- str regex
Return: Note or None if not found
Source code in odfdo/element.py
2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 |
|
get_notes(note_class=None, content=None)
Return all the notes that match the criteria.
Arguments:
note_class -- 'footnote' or 'endnote'
content -- str regex
Return: list of Note
Source code in odfdo/element.py
2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 |
|
get_office_names()
Return all the used office:name tags values of the element.
Return: list of unique str
Source code in odfdo/element.py
2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 |
|
get_orphan_draw_connectors()
Return a list of connectors which don’t have any shape connected to them.
Source code in odfdo/element.py
3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 |
|
get_paragraph(position=0, content=None)
Return the paragraph that matches the criteria.
Arguments:
position -- int
content -- str regex
Return: Paragraph or None if not found
Source code in odfdo/element.py
1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 |
|
get_paragraphs(style=None, content=None)
Return all the paragraphs that match the criteria.
Arguments:
style -- str
content -- str regex
Return: list of Paragraph
Source code in odfdo/element.py
1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 |
|
get_reference_mark(position=0, name=None)
Return the reference mark that match the criteria. Either single position reference mark (text:reference-mark) or start of range reference (text:reference-mark-start).
Arguments:
position -- int
name -- str
Return: Element or None if not found
Source code in odfdo/element.py
2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 |
|
get_reference_mark_end(position=0, name=None)
Return the reference mark end that matches the criteria. Search only the tags text:reference-mark-end. Consider using : get_reference_marks()
Arguments:
position -- int
name -- str
Return: Element or None if not found
Source code in odfdo/element.py
2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 |
|
get_reference_mark_ends()
Return all the reference mark ends. Search only the tags text:reference-mark-end. Consider using : get_reference_marks()
Return: list of Element
Source code in odfdo/element.py
2831 2832 2833 2834 2835 2836 2837 2838 |
|
get_reference_mark_single(position=0, name=None)
Return the reference mark that matches the criteria. Search only the tags text:reference-mark. Consider using : get_reference_mark()
Arguments:
position -- int
name -- str
Return: Element or None if not found
Source code in odfdo/element.py
2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 |
|
get_reference_mark_start(position=0, name=None)
Return the reference mark start that matches the criteria. Search only the tags text:reference-mark-start. Consider using : get_reference_mark()
Arguments:
position -- int
name -- str
Return: Element or None if not found
Source code in odfdo/element.py
2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 |
|
get_reference_mark_starts()
Return all the reference mark starts. Search only the tags text:reference-mark-start. Consider using : get_reference_marks()
Return: list of Element
Source code in odfdo/element.py
2801 2802 2803 2804 2805 2806 2807 2808 |
|
get_reference_marks()
Return all the reference marks, either single position reference (text:reference-mark) or start of range reference (text:reference-mark-start).
Return: list of Element
Source code in odfdo/element.py
2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 |
|
get_reference_marks_single()
Return all the reference marks. Search only the tags text:reference-mark. Consider using : get_reference_marks()
Return: list of Element
Source code in odfdo/element.py
2771 2772 2773 2774 2775 2776 2777 2778 |
|
get_references(name=None)
Return all the references (text:reference-ref). If name is provided, returns the references of that name.
Return: list of Element
Arguments:
name -- str or None
Source code in odfdo/element.py
2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 |
|
get_section(position=0, content=None)
Return the section that matches the criteria.
Arguments:
position -- int
content -- str regex
Return: Element or None if not found
Source code in odfdo/element.py
1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 |
|
get_sections(style=None, content=None)
Return all the sections that match the criteria.
Arguments:
style -- str
content -- str regex
Return: list of Element
Source code in odfdo/element.py
1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 |
|
get_span(position=0, content=None)
Return the span that matches the criteria.
Arguments:
position -- int
content -- str regex
Return: Span or None if not found
Source code in odfdo/element.py
1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 |
|
get_spans(style=None, content=None)
Return all the spans that match the criteria.
Arguments:
style -- str
content -- str regex
Return: list of Span
Source code in odfdo/element.py
1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 |
|
get_style(family, name_or_element=None, display_name=None)
Return the style uniquely identified by the family/name pair. If the argument is already a style object, it will return it.
If the name is not the internal name but the name you gave in the desktop application, use display_name instead.
Arguments:
family -- 'paragraph', 'text', 'graphic', 'table', 'list',
'number'
name_or_element -- str or Style
display_name -- str
Return: odf_style or None if not found
Source code in odfdo/element.py
3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 |
|
get_styled_elements(name='')
Brute-force to find paragraphs, tables, etc. using the given style name (or all by default).
Arguments:
name -- str
Return: list
Source code in odfdo/element.py
1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 |
|
get_text_change(position=0, idx=None)
Return the text change that matches the criteria. Either single deletion (text:change) or start of range of changes (text:change-start). position : index of the element to retrieve if several matches, default is 0. idx : change-id of the element.
Arguments:
position -- int
idx -- str
Return: Element or None if not found
Source code in odfdo/element.py
3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 |
|
get_text_change_deletion(position=0, idx=None)
Return the text change of deletion kind that matches the criteria. Search only for the tags text:change. Consider using : get_text_change()
Arguments:
position -- int
idx -- str
Return: Element or None if not found
Source code in odfdo/element.py
3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 |
|
get_text_change_deletions()
Return all the text changes of deletion kind: the tags text:change. Consider using : get_text_changes()
Return: list of Element
Source code in odfdo/element.py
3186 3187 3188 3189 3190 3191 3192 |
|
get_text_change_end(position=0, idx=None)
Return the text change-end that matches the criteria. Search only the tags text:change-end. Consider using : get_text_change()
Arguments:
position -- int
idx -- str
Return: Element or None if not found
Source code in odfdo/element.py
3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 |
|
get_text_change_ends()
Return all the text change-end. Search only the tags text:change-end. Consider using : get_text_changes()
Return: list of Element
Source code in odfdo/element.py
3245 3246 3247 3248 3249 3250 3251 3252 |
|
get_text_change_start(position=0, idx=None)
Return the text change-start that matches the criteria. Search only the tags text:change-start. Consider using : get_text_change()
Arguments:
position -- int
idx -- str
Return: Element or None if not found
Source code in odfdo/element.py
3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 |
|
get_text_change_starts()
Return all the text change-start. Search only for the tags text:change-start. Consider using : get_text_changes()
Return: list of Element
Source code in odfdo/element.py
3215 3216 3217 3218 3219 3220 3221 3222 |
|
get_text_changes()
Return all the text changes, either single deletion (text:change) or start of range of changes (text:change-start).
Return: list of Element
Source code in odfdo/element.py
3275 3276 3277 3278 3279 3280 3281 3282 |
|
get_toc(position=0, content=None)
Return the table of contents that matches the criteria.
Arguments:
position -- int
content -- str regex
Return: odf_toc or None if not found
Source code in odfdo/element.py
3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 |
|
get_tocs()
Return all the tables of contents.
Return: list of odf_toc
Source code in odfdo/element.py
3323 3324 3325 3326 3327 3328 |
|
get_tracked_changes()
Return the tracked-changes part in the text body.
Return: Element or None
Source code in odfdo/element.py
3161 3162 3163 3164 3165 3166 |
|
get_user_defined(name, position=0)
return the user defined declaration for the given name.
return: Element or none if not found
Source code in odfdo/element.py
2554 2555 2556 2557 2558 2559 2560 2561 |
|
get_user_defined_list()
Return all the user defined field declarations.
Return: list of Element
Source code in odfdo/element.py
2539 2540 2541 2542 2543 2544 |
|
get_user_defined_value(name, value_type=None)
Return the value of the given user defined field name.
Arguments:
name -- str
value_type -- 'boolean', 'date', 'float',
'string', 'time' or automatic
Return: most appropriate Python type
Source code in odfdo/element.py
2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 |
|
get_user_field_decl(name, position=0)
return the user field declaration for the given name.
return: Element or none if not found
Source code in odfdo/element.py
2508 2509 2510 2511 2512 2513 2514 2515 |
|
get_user_field_decl_list()
Return all the user field declarations.
Return: list of Element
Source code in odfdo/element.py
2501 2502 2503 2504 2505 2506 |
|
get_user_field_decls()
Return the container for user field declarations. Created if not found.
Return: Element
Source code in odfdo/element.py
2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 |
|
get_user_field_value(name, value_type=None)
Return the value of the given user field name.
Arguments:
name -- str
value_type -- 'boolean', 'currency', 'date', 'float',
'percentage', 'string', 'time' or automatic
Return: most appropriate Python type
Source code in odfdo/element.py
2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 |
|
get_variable_decl(name, position=0)
return the variable declaration for the given name.
Arguments:
name -- str
position -- int
return: Element or none if not found
Source code in odfdo/element.py
2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 |
|
get_variable_decl_list()
Return all the variable declarations.
Return: list of Element
Source code in odfdo/element.py
2414 2415 2416 2417 2418 2419 |
|
get_variable_decls()
Return the container for variable declarations. Created if not found.
Return: Element
Source code in odfdo/element.py
2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 |
|
get_variable_set(name, position=-1)
Return the variable set for the given name (last one by default).
Arguments:
name -- str
position -- int
Return: Element or None if not found
Source code in odfdo/element.py
2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 |
|
get_variable_set_value(name, value_type=None)
Return the last value of the given variable name.
Arguments:
name -- str
value_type -- 'boolean', 'currency', 'date', 'float',
'percentage', 'string', 'time' or automatic
Return: most appropriate Python type
Source code in odfdo/element.py
2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 |
|
get_variable_sets(name=None)
Return all the variable sets that match the criteria.
Arguments:
name -- str
Return: list of Element
Source code in odfdo/element.py
2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 |
|
index(child)
Return the position of the child in this element.
Inspired by lxml
Source code in odfdo/element.py
1089 1090 1091 1092 1093 1094 |
|
insert(element, xmlposition=None, position=None, start=False)
Insert an element relatively to ourself.
Insert either using DOM vocabulary or by numeric position. If text start is True, insert the element before any existing text.
Position start at 0.
Arguments:
element -- Element
xmlposition -- FIRST_CHILD, LAST_CHILD, NEXT_SIBLING
or PREV_SIBLING
start -- Boolean
position -- int
Source code in odfdo/element.py
1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 |
|
is_empty()
Check if the element is empty : no text, no children, no tail.
Return: Boolean
Source code in odfdo/element.py
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 |
|
match(pattern)
return True if the pattern is found one or more times anywhere in the text content of the element.
Python regular expression syntax applies.
Arguments:
pattern -- str
Return: bool
Source code in odfdo/element.py
976 977 978 979 980 981 982 983 984 985 986 987 988 |
|
replace(pattern, new=None, formatted=False)
Replace the pattern with the given text, or delete if text is an empty string, and return the number of replacements. By default, only return the number of occurences that would be replaced.
It cannot replace patterns found across several element, like a word split into two consecutive spans.
Python regular expression syntax applies.
If formatted is True, and the target is a Paragraph, Span or Header, and the replacement text contains spaces, tabs or newlines, try to convert them into actual ODF elements to obtain a formatted result. On very complex contents, result may differ of expectations.
Arguments:
pattern -- str
new -- str
formatted -- bool
Return: int
Source code in odfdo/element.py
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
|
replace_element(old_element, new_element)
Replaces in place a sub element with the element passed as second argument.
Warning : no clone for old element.
Source code in odfdo/element.py
1516 1517 1518 1519 1520 1521 1522 1523 |
|
search(pattern)
Return the first position of the pattern in the text content of the element, or None if not found.
Python regular expression syntax applies.
Arguments:
pattern -- str
Return: int or None
Source code in odfdo/element.py
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 |
|
search_all(pattern)
Return all start and end positions of the regex pattern in the text content of the element.
Result is a list of tuples of start and end position of the matches. Python regular expression syntax applies.
Arguments:
pattern -- str
Return: list[tuple[int,int]]
Source code in odfdo/element.py
934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 |
|
search_first(pattern)
Return the start and end position of the first occurence of the regex pattern in the text content of the element.
Result is tuples of start and end position, or None. Python regular expression syntax applies.
Arguments:
pattern -- str
Return: tuple[int,int] or None
Source code in odfdo/element.py
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 |
|
serialize(pretty=False, with_ns=False)
Return text serialization of XML element.
Source code in odfdo/element.py
1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 |
|
set_style_attribute(name, value)
Shortcut to accept a style object as a value.
Source code in odfdo/element.py
845 846 847 848 849 |
|
strip_elements(sub_elements)
Remove the tags of provided elements, keeping inner childs and text.
Return : the striped element.
Warning : no clone in sub_elements list.
Arguments:
sub_elements -- Element or list of Element
Source code in odfdo/element.py
1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 |
|
strip_tags(strip=None, protect=None, default='text:p')
Remove the tags listed in strip, recursively, keeping inner childs and text. Tags listed in protect stop the removal one level depth. If the first level element is stripped, default is used to embed the content in the default element. If default is None and first level is striped, a list of text and children is returned. Return : the striped element.
strip_tags should be used by on purpose methods (strip_span …) (Method name taken from lxml).
Arguments:
strip -- iterable list of str odf tags, or None
protect -- iterable list of str odf tags, or None
default -- str odf tag, or None
Return:
Element.
Source code in odfdo/element.py
1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 |
|
text_at(start, end=None)
Return the text (recursive) content of the element between start and end position.
If the end parameter is not set, return from start to the end of the recursive text.
Arguments:
start -- int
end -- int or None
Return: str
Source code in odfdo/element.py
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 |
|
xpath(xpath_query)
Apply XPath query to the element and its subtree. Return list of Element or EText instances translated from the nodes found.
Source code in odfdo/element.py
1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 |
|
ElementTyped
Bases: Element
Source code in odfdo/element_typed.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
get_value(value_type=None, try_get_text=True, get_type=False)
Return Python typed value.
Only for “with office:value-type” elements, not for meta fields.
Source code in odfdo/element_typed.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
EllipseShape
Bases: ShapeBase
Create a ellipse shape.
Arguments:
style -- str
text_style -- str
draw_id -- str
layer -- str
position -- (str, str)
size -- (str, str)
Source code in odfdo/shapes.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
|
Frame
Bases: MDDrawFrame
, Element
, AnchorMix
, PosMix
, ZMix
, SizeMix
ODF Frame “draw:frame”
Frames are not useful by themselves. You should consider calling Frame.image_frame() or Frame.text_frame directly.
Source code in odfdo/frame.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 |
|
__init__(name=None, draw_id=None, style=None, position=None, size=('1cm', '1cm'), z_index=0, presentation_class=None, anchor_type=None, anchor_page=None, layer=None, presentation_style=None, **kwargs)
Create a frame element of the given size. Position is relative to the context the frame is inserted in. If positioned by page, give the page number and the x, y position.
Size is a (width, height) tuple and position is a (left, top) tuple; items are strings including the unit, e.g. (‘10cm’, ‘15cm’).
Frames are not useful by themselves. You should consider calling: Frame.image_frame() or Frame.text_frame()
Arguments:
name -- str
draw_id -- str
style -- str
position -- (str, str)
size -- (str, str)
z_index -- int (default 0)
presentation_class -- str
anchor_type -- 'page', 'frame', 'paragraph', 'char' or 'as-char'
anchor_page -- int, page number is anchor_type is 'page'
layer -- str
presentation_style -- str
Source code in odfdo/frame.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
image_frame(image, text=None, name=None, draw_id=None, style=None, position=None, size=('1cm', '1cm'), z_index=0, presentation_class=None, anchor_type=None, anchor_page=None, layer=None, presentation_style=None, **kwargs)
classmethod
Create a ready-to-use image, since image must be embedded in a frame.
The optionnal text will appear above the image.
Arguments:
image -- DrawImage or str, DrawImage element or URL of the image
text -- str, text for the image
See Frame() initialization for the other arguments
Return: Frame
Source code in odfdo/frame.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
|
text_frame(text_or_element, text_style=None, name=None, draw_id=None, style=None, position=None, size=('1cm', '1cm'), z_index=0, presentation_class=None, anchor_type=None, anchor_page=None, layer=None, presentation_style=None, **kwargs)
classmethod
Create a ready-to-use text box, since text box must be embedded in a frame.
The optionnal text will appear above the image.
Arguments:
text_or_element -- str or Element, or list of them, text content
of the text box.
text_style -- str, name of the style for the text
See Frame() initialization for the other arguments
Return: Frame
Source code in odfdo/frame.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
|
Header
Bases: Paragraph
, MDHeader
Specialised paragraph for headings “text:h”.
Source code in odfdo/header.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
__init__(level=1, text=None, restart_numbering=False, start_value=None, suppress_numbering=False, style=None, formatted=True, **kwargs)
Create a header element of the given style and level, containing the optional given text.
Level count begins at 1.
If “formatted” is True (the default), the given text is appended with
Arguments:
level -- int
text -- str
restart_numbering -- bool
start_value -- int
style -- str
formatted -- bool
Source code in odfdo/header.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
Image
Bases: Body
Image, specialized class of Element in charge of actual content management.
Source code in odfdo/body.py
119 120 121 122 123 124 125 |
|
IndexTitle
Bases: Element
The “text:index-title” element contains the title of an index.
The element has the following attributes: text:name, text:protected, text:protection-key, text:protection-key-digest-algorithm, text:style-name, xml:id.
The actual title is stored in a child element
Source code in odfdo/toc.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
IndexTitleTemplate
Bases: Element
ODF “text:index-title-template”
Arguments:
style -- str
Source code in odfdo/toc.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
|
LineBreak
Bases: MDLineBreak
, Element
This element represents a line break “text:line-break”
Source code in odfdo/paragraph_base.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|
LineShape
Bases: ShapeBase
Create a line shape.
Arguments:
style -- str
text_style -- str
draw_id -- str
layer -- str
p1 -- (str, str)
p2 -- (str, str)
Source code in odfdo/shapes.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
Link
Bases: MDLink
, ParagraphBase
Link class, “text:a” ODF element.
Source code in odfdo/link.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
__init__(url='', name=None, title=None, text=None, target_frame=None, style=None, visited_style=None, **kwargs)
Arguments:
url -- str
name -- str
title -- str
text -- str
target_frame -- '_self', '_blank', '_parent', '_top'
style -- str
visited_style -- str
Source code in odfdo/link.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
List
Bases: MDList
, Element
ODF List “text:list”.
Source code in odfdo/list.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
__init__(list_content=None, style=None, **kwargs)
Create a list element, optionaly loading the list by a list of item (str or elements).
The list_content argument is just a shortcut for the most common case. To create more complex lists, first create an empty list, and fill it afterwards.
Arguments:
list_content -- str or Element, or a list of str or Element
style -- str
Source code in odfdo/list.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
get_item(position=0, content=None)
Return the list item that matches the criteria. In nested lists, return the list item that really contains that content.
Arguments:
position -- int
content -- str regex
Return: Element or None if not found
Source code in odfdo/list.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
get_items(content=None)
Return all the list items that match the criteria.
Arguments:
style -- str
content -- str regex
Return: list of Element
Source code in odfdo/list.py
108 109 110 111 112 113 114 115 116 117 118 119 |
|
ListItem
Bases: MDListItem
, Element
ODF element “text:list-item”, item of a List.
Source code in odfdo/list.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
__init__(text_or_element=None, **kwargs)
Create a list item element, optionaly passing at creation time a string or Element as content.
Arguments:
text_or_element -- str or ODF Element
Source code in odfdo/list.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
Manifest
Bases: XmlPart
Source code in odfdo/manifest.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
get_media_type(full_path)
Get the media type of an existing path.
Return: str
Source code in odfdo/manifest.py
66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
get_path_medias()
Return the list of (full_path, media_type) pairs in the manifest.
Return: list of str tuples
Source code in odfdo/manifest.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
get_paths()
Return the list of full paths in the manifest.
Return: list of str
Source code in odfdo/manifest.py
31 32 33 34 35 36 37 |
|
set_media_type(full_path, media_type)
Set the media type of an existing path.
Arguments:
full_path -- str
media_type -- str
Source code in odfdo/manifest.py
80 81 82 83 84 85 86 87 88 89 90 |
|
Meta
Bases: XmlPart
, DcCreatorMixin
, DcDateMixin
Source code in odfdo/meta.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 |
|
auto_reload
property
Get the MetaAutoReload
creation_date
property
writable
Get or set the date and time when a document was created
If provided datetime is None, use current time.
Return: datetime (or None if inexistant)
description
property
writable
Get or set the description of a document
Return: str (or None if inexistant)
editing_cycles
property
writable
Get or set the number of times a document has been edited
When a document is created, this value is set to 1. Each time a document is saved, the editing-cycles number is incremented by 1.
Return: int (or None if inexistant)
editing_duration
property
writable
Get or set the total time spent editing a document
Return: timedelta (or None if inexistant)
generator
property
writable
Get or set the signature of the software that generated this document.
Return: str (or None if inexistant)
Example::
>>> document.meta.generator
KOffice/2.0.0
>>> document.meta.generator = "Odfdo experiment"
hyperlink_behaviour
property
Get the MetaHyperlinkBehaviour
initial_creator
property
writable
Get or set the initial creator of a document
Return: str (or None if inexistant)
keyword
property
writable
Get or set some keyword(s) keyword pertaining to a document
Return: str (or None if inexistant)
language
property
writable
Get or set the default language of the document
Return: str (or None if inexistant)
print_date
property
writable
Get or set the date and time when a document when a document was last printed
If provided datetime is None, use current time.
Return: datetime (or None if inexistant)
printed_by
property
writable
Get or set the name of the last person who printed a document.
Return: str (or None if inexistant)
statistic
property
writable
Get or set the statistics about a document
Return: dict (or None if inexistant)
Example::
>>> document.get_statistic():
{'meta:table-count': 1,
'meta:image-count': 2,
'meta:object-count': 3,
'meta:page-count': 4,
'meta:paragraph-count': 5,
'meta:word-count': 6,
'meta:character-count': 7,
'meta:non-whitespace-character-count':3}
subject
property
writable
Get or set the subject of a document
Return: str (or None if inexistant)
template
property
Get the MetaTemplate
title
property
writable
Get or set the title of the document
Return: str (or None if inexistant)
user_defined_metadata
property
writable
Get or set all additional user-defined metadata for a document.
Return a dict of str/value mapping.
Value types can be: Decimal, date, time, boolean or str.
as_dict(full=False)
Return the metadata of the document as a Python dict.
if ‘full’ is True, export also the keys with no value assigned.
Arguments:
full -- boolean
Source code in odfdo/meta.py
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 |
|
as_json(full=False)
Return the metadata of the document as a JSON string.
if ‘full’ is True, export also the keys with no value assigned.
Arguments:
full -- boolean
Source code in odfdo/meta.py
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 |
|
as_text()
Return meta informations as text, with some formatting for printing.
Source code in odfdo/meta.py
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 |
|
clear_user_defined_metadata()
Remove all user-defined metadata.
Source code in odfdo/meta.py
792 793 794 795 796 797 798 799 |
|
from_dict(data)
Set the metadata of the document from a Python dict.
The loaded metadata are merged with the existing metadata. If the new value of a key is None: - meta:creation-date: use current time, - dc:date: use creation date, - meta:editing-duration: set to zero, - meta:editing-cycles: set to 1, - meta:generator: use odfdo generator string. Other keys (not mandatory keys): remove key/value pair from metadata.
Arguments:
data -- dict of metadata.
Source code in odfdo/meta.py
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 |
|
get_auto_reload()
Get the MetaAutoReload
Source code in odfdo/meta.py
354 355 356 357 358 359 |
|
get_creation_date()
Get the creation date of the document.
(Also available as “self.creation_date” property.)
Return: datetime (or None if inexistant)
Source code in odfdo/meta.py
257 258 259 260 261 262 263 264 265 266 267 268 |
|
get_description()
Get the description of the document. Also known as comments.
(Also available as “self.description” property.)
Return: str (or None if inexistant)
Source code in odfdo/meta.py
100 101 102 103 104 105 106 107 108 109 110 |
|
get_editing_cycles()
Get the number of times the document was edited, as reported by the generator.
(Also available as “self.editing_cycles” property.)
Return: int (or None if inexistant)
Source code in odfdo/meta.py
557 558 559 560 561 562 563 564 565 566 567 568 569 |
|
get_editing_duration()
Get the time the document was edited, as reported by the generator.
(Also available as “self.editing_duration” property.)
Return: timedelta (or None if inexistant)
Source code in odfdo/meta.py
513 514 515 516 517 518 519 520 521 522 523 524 525 |
|
get_generator()
Get the signature of the software that generated this document.
(Also available as “self.generator” property.)
Return: str (or None if inexistant)
Example::
>>> document.meta.get_generator()
KOffice/2.0.0
Source code in odfdo/meta.py
633 634 635 636 637 638 639 640 641 642 643 644 645 |
|
get_hyperlink_behaviour()
Get the MetaHyperlinkBehaviour
Source code in odfdo/meta.py
374 375 376 377 378 379 |
|
get_initial_creator()
Get the first creator of the document.
(Also available as “self.initial_creator” property.)
Return: str (or None if inexistant)
Example::
>>> document.meta.get_initial_creator()
Unknown
Source code in odfdo/meta.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
get_keywords()
Get the keywords of the document. Return the field as-is, without any assumption on the keyword separator.
(Also available as “self.keyword” and “self.keywords” property.)
Return: str (or None if inexistant)
Source code in odfdo/meta.py
469 470 471 472 473 474 475 476 477 478 479 480 |
|
get_language()
Get the default language of the document.
(Also available as “self.language” property.)
Return: str (or None if inexistant)
Example::
>>> document.meta.get_language()
fr-FR
Source code in odfdo/meta.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
get_statistic()
Get the statistics about a document.
(Also available as “self.statistic” property.)
Return: dict (or None if inexistant)
Example::
>>> document.get_statistic():
{'meta:table-count': 1,
'meta:image-count': 2,
'meta:object-count': 3,
'meta:page-count': 4,
'meta:paragraph-count': 5,
'meta:word-count': 6,
'meta:character-count': 7,
'meta:non-whitespace-character-count': 3}
Source code in odfdo/meta.py
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 |
|
get_subject()
Get the subject of the document.
(Also available as “self.subject” property.)
Return: str (or None if inexistant)
Source code in odfdo/meta.py
144 145 146 147 148 149 150 151 152 153 154 |
|
get_template()
Get the MetaTemplate
Source code in odfdo/meta.py
329 330 331 332 333 334 |
|
get_title()
Get the title of the document.
This is not the first heading but the title metadata.
(Also available as “self.title” property.)
Return: str (or None if inexistant)
Source code in odfdo/meta.py
57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
get_user_defined_metadata()
Get all additional user-defined metadata for a document.
(Also available as “self.user_defined_metadata” property.)
Return a dict of str/value mapping.
Value types can be: Decimal, date, time, boolean or str.
Source code in odfdo/meta.py
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 |
|
get_user_defined_metadata_of_name(keyname)
Return the content of the user defined metadata of that name. Return None if no name matchs or a dic of fields.
Arguments:
name -- string, name (meta:name content)
Source code in odfdo/meta.py
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 |
|
set_auto_reload(delay, href='')
Set the MetaAutoReload
Source code in odfdo/meta.py
366 367 368 369 370 371 372 |
|
set_creation_date(date=None)
Set the creation date of the document.
If provided datetime is None, use current time.
(Also available as “self.creation_date” property.)
Arguments:
date -- datetime
Source code in odfdo/meta.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
|
set_description(description)
Set the description of the document. Also known as comments.
(Also available as “self.description” property.)
Arguments:
description -- str
Source code in odfdo/meta.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
set_editing_cycles(cycles)
Set the number of times the document was edited.
(Also available as “self.editing_cycles” property.)
Arguments:
cycles -- int
Source code in odfdo/meta.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 |
|
set_editing_duration(duration)
Set the time the document was edited.
(Also available as “self.editing_duration” property.)
Arguments:
duration -- timedelta
Source code in odfdo/meta.py
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
|
set_generator(generator)
Set the signature of the software that generated this document.
(Also available as “self.generator” property.)
Arguments:
generator -- str
Example::
>>> document.meta.set_generator("Odfdo experiment")
Source code in odfdo/meta.py
647 648 649 650 651 652 653 654 655 656 657 658 659 660 |
|
set_generator_default()
Set the signature of the software that generated this document to ourself.
Example::
>>> document.meta.set_generator_default()
Source code in odfdo/meta.py
662 663 664 665 666 667 668 669 670 671 |
|
set_hyperlink_behaviour(target_frame_name='_blank', show='replace')
Set the MetaHyperlinkBehaviour
Source code in odfdo/meta.py
386 387 388 389 390 391 392 393 394 395 396 397 398 |
|
set_initial_creator(creator)
Set the first creator of the document.
(Also available as “self.initial_creator” property.)
Arguments:
creator -- str
Example::
>>> document.meta.set_initial_creator("Plato")
Source code in odfdo/meta.py
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
|
set_keywords(keywords)
Set the keywords of the document. Although the name is plural, a str string is required, so join your list first.
(Also available as “self.keyword” and “self.keywords” property.)
Arguments:
keywords -- str
Source code in odfdo/meta.py
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
|
set_language(language)
Set the default language of the document.
(Also available as “self.language” property.)
Arguments:
language -- str
Example::
>>> document.meta.set_language('fr-FR')
Source code in odfdo/meta.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
set_statistic(statistic)
Set the statistics about a document.
(Also available as “self.statistic” property.)
Arguments:
statistic -- dict
Example::
>>> statistic = {'meta:table-count': 1,
'meta:image-count': 2,
'meta:object-count': 3,
'meta:page-count': 4,
'meta:paragraph-count': 5,
'meta:word-count': 6,
'meta:character-count': 7,
'meta:non-whitespace-character-count': 3}
>>> document.meta.set_statistic(statistic)
Source code in odfdo/meta.py
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 |
|
set_subject(subject)
Set the subject of the document.
(Also available as “self.subject” property.)
Arguments:
subject -- str
Source code in odfdo/meta.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
set_template(date=None, href='', title='')
Set the MetaTemplate
Source code in odfdo/meta.py
341 342 343 344 345 346 347 348 349 350 351 352 |
|
set_title(title)
Set the title of the document.
This is not the first heading but the title metadata.
(Also available as “self.title” property.)
Arguments:
title -- str
Source code in odfdo/meta.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
MetaAutoReload
Bases: Element
Source code in odfdo/meta_auto_reload.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
__init__(delay=None, href='', **kwargs)
The
Arguments:
delay -- timedelta
href -- str
Source code in odfdo/meta_auto_reload.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
as_dict()
Return the MetaAutoReload attributes as a Python dict.
Source code in odfdo/meta_auto_reload.py
79 80 81 82 83 84 85 86 87 |
|
MetaHyperlinkBehaviour
Bases: Element
Source code in odfdo/meta_hyperlink_behaviour.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
__init__(target_frame_name='_blank', show='replace', **kwargs)
The
Arguments:
target_frame_name -- str
show -- str
Source code in odfdo/meta_hyperlink_behaviour.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
as_dict()
Return the MetaHyperlinkBehaviour attributes as a Python dict.
Source code in odfdo/meta_hyperlink_behaviour.py
68 69 70 71 72 73 |
|
MetaTemplate
Bases: Element
Source code in odfdo/meta_template.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
__init__(date=None, href='', title='', **kwargs)
The
Arguments:
date -- datetime or None
href -- str
title -- str
Source code in odfdo/meta_template.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
as_dict()
Return the MetaTemplate attributes as a Python dict.
Source code in odfdo/meta_template.py
81 82 83 84 85 86 87 88 89 |
|
NamedRange
Bases: Element
ODF Named Range “table:named-range”. Identifies inside the spreadsheet a range of cells of a table by a name and the name of the table.
Name Ranges have the following attributes:
name -- name of the named range
table_name -- name of the table
start -- first cell of the named range, tuple (x, y)
end -- last cell of the named range, tuple (x, y)
crange -- range of the named range, tuple (x, y, z, t)
usage -- None or str, usage of the named range.
Source code in odfdo/table.py
2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 |
|
name
property
writable
Get / set the name of the table.
__init__(name=None, crange=None, table_name=None, usage=None, **kwargs)
Create a Named Range element. ‘name’ must contains only letters, digits and ‘_’, and must not be like a coordinate as ‘A1’. ‘table_name’ must be a correct table name (no “’” or “/” in it).
Arguments:
name -- str, name of the named range
crange -- str or tuple of int, cell or area coordinate
table_name -- str, name of the table
usage -- None or 'print-range', 'filter', 'repeat-column', 'repeat-row'
Source code in odfdo/table.py
2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 |
|
get_value(get_type=False)
Shortcut to retrieve the value of the first cell of the named range. See table.get_value() for the arguments description and return format.
Source code in odfdo/table.py
3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 |
|
get_values(cell_type=None, complete=True, get_type=False, flat=False)
Shortcut to retrieve the values of the cells of the named range. See table.get_values() for the arguments description and return format.
Source code in odfdo/table.py
3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 |
|
set_range(crange)
Set the range of the named range. Range can be either one cell (like ‘A1’) or an area (‘A1:B2’). It can be provided as an alpha numeric value like “A1:B2’ or a tuple like (0, 0, 1, 1) or (0, 0).
Arguments:
crange -- str or tuple of int, cell or area coordinate
Source code in odfdo/table.py
3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 |
|
set_table_name(name)
Set the name of the table of the Named Range. The name is mandatory.
Arguments:
name -- str
Source code in odfdo/table.py
3079 3080 3081 3082 3083 3084 3085 3086 3087 |
|
set_usage(usage=None)
Set the usage of the Named Range. Usage can be None (default) or one of : ‘print-range’ ‘filter’ ‘repeat-column’ ‘repeat-row’
Arguments:
usage -- None or str
Source code in odfdo/table.py
3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 |
|
set_value(value, cell_type=None, currency=None, style=None)
Shortcut to set the value of the first cell of the named range. See table.set_value() for the arguments description.
Source code in odfdo/table.py
3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 |
|
set_values(values, style=None, cell_type=None, currency=None)
Shortcut to set the values of the cells of the named range. See table.set_values() for the arguments description.
Source code in odfdo/table.py
3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 |
|
Note
Bases: MDNote
, Element
Either a footnote or a endnote element with the given text, optionally referencing it using the given note_id.
Arguments:
note_class -- 'footnote' or 'endnote'
note_id -- str
citation -- str
body -- str or Element
Source code in odfdo/note.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
Paragraph
Bases: MDParagraph
, ParagraphBase
Specialised element for paragraphs “text:p”. The “text:p” element represents a paragraph, which is the basic unit of text in an OpenDocument file.
Source code in odfdo/paragraph.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
|
__init__(text_or_element=None, style=None, formatted=True, **kwargs)
Create a paragraph element of the given style containing the optional given text.
If “formatted” is True (the default), the given text is appended with
Arguments:
text -- str, bytes or Element
style -- str
formatted -- bool
Source code in odfdo/paragraph.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
append_plain_text(text='')
Append plain text to the paragraph, replacing
Source code in odfdo/paragraph.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
insert_annotation(annotation_element=None, before=None, after=None, position=0, content=None, body=None, creator=None, date=None)
Insert an annotation, at the position defined by the regex (before, after, content) or by positionnal argument (position). If content is provided, the annotation covers the full content regex. Else, the annotation is positionned either ‘before’ or ‘after’ provided regex.
If content is an odf element (ie: paragraph, span, …), the full inner content is covered by the annotation (of the position just after if content is a single empty tag).
If content/before or after exists (regex) and return a group of matching positions, the position value is the index of matching place to use.
annotation_element can contain a previously created annotation, else the annotation is created from the body, creator and optional date (current date by default).
Arguments:
annotation_element -- Annotation or None
before -- str regular expression or None
after -- str regular expression or Element or None
content -- str regular expression or None, or Element
position -- int or tuple of int
body -- str or Element
creator -- str
date -- datetime
Source code in odfdo/paragraph.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
|
insert_annotation_end(annotation_element, before=None, after=None, position=0)
Insert an annotation end tag for an existing annotation. If some end tag already exists, replace it. Annotation end tag is set at the position defined by the regex (before or after).
If content/before or after (regex) returns a group of matching positions, the position value is the index of matching place to use.
Arguments:
annotation_element -- Annotation (mandatory)
before -- str regular expression or None
after -- str regular expression or None
position -- int
Source code in odfdo/paragraph.py
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 |
|
insert_reference(name, ref_format='', before=None, after=None, position=0, display=None)
Create and insert a reference to a content marked by a reference mark. The Reference element (“text:reference-ref”) represents a field that references a “text:reference-mark-start” or “text:reference-mark” element. Its “text:reference-format” attribute specifies what is displayed from the referenced element. Default is ‘page’. Actual content is not automatically updated except for the ‘text’ format.
name is mandatory and should represent an existing reference mark of the document.
ref_format is the argument for format reference (default is ‘page’).
The reference is inserted the position defined by the regex (before / after), or by positionnal argument (position). If ‘display’ is provided, it will be used as the text value for the reference.
If after is an ODF Element, the reference is inserted as first child of this element.
Arguments:
name -- str
ref_format -- one of : 'chapter', 'direction', 'page', 'text',
'caption', 'category-and-value', 'value',
'number', 'number-all-superior',
'number-no-superior'
before -- str regular expression or None
after -- str regular expression or odf element or None
position -- int
display -- str or None
Source code in odfdo/paragraph.py
794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 |
|
remove_link(links)
Send back a copy of the element (not a clone), with the sub links removed.
Arguments:
links -- Link or list of Link
Source code in odfdo/paragraph.py
784 785 786 787 788 789 790 791 792 |
|
remove_links()
Send back a copy of the element, without links tags.
Source code in odfdo/paragraph.py
779 780 781 782 |
|
remove_span(spans)
Send back a copy of the element, the spans (not a clone) removed.
Arguments:
spans -- Element or list of Element
Source code in odfdo/paragraph.py
739 740 741 742 743 744 745 746 |
|
remove_spans(keep_heading=True)
Send back a copy of the element, without span styles. If keep_heading is True (default), the first level heading style is left unchanged.
Source code in odfdo/paragraph.py
727 728 729 730 731 732 733 734 735 736 737 |
|
set_bookmark(name, before=None, after=None, position=0, role=None, content=None)
Insert a bookmark before or after the characters in the text which match the regex before/after. When the regex matches more of one part of the text, position can be set to choose which part must be used. If before and after are None, we use only position that is the number of characters.
So, by default, this function inserts a bookmark before the first character of the content. Role can be None, “start” or “end”, we insert respectively a position bookmark a bookmark-start or a bookmark-end.
If content is not None these 2 calls are equivalent:
paragraph.set_bookmark(“bookmark”, content=”xyz”)
and:
paragraph.set_bookmark(“bookmark”, before=”xyz”, role=”start”) paragraph.set_bookmark(“bookmark”, after=”xyz”, role=”end”)
If position is a 2-tuple, these 2 calls are equivalent:
paragraph.set_bookmark(“bookmark”, position=(10, 20))
and:
paragraph.set_bookmark(“bookmark”, position=10, role=”start”) paragraph.set_bookmark(“bookmark”, position=20, role=”end”)
Arguments:
name -- str
before -- str regex
after -- str regex
position -- int or (int, int)
role -- None, "start" or "end"
content -- str regex
Source code in odfdo/paragraph.py
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
|
set_link(match, tail, url, regex=None, offset=None, length=0)
set_link(url, regex=None, offset=None, length=0) Make a link to the provided url from text content matching the regex OR the positional arguments offset and length.
(match, tail: provided by regex decorator)
Arguments:
url -- str
regex -- str regular expression
offset -- int
length -- int
Source code in odfdo/paragraph.py
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 |
|
set_reference_mark(name, before=None, after=None, position=0, content=None)
Insert a reference mark, at the position defined by the regex (before, after, content) or by positionnal argument (position). If content is provided, the annotation covers the full range content regex (instances of ReferenceMarkStart and ReferenceMarkEnd are created). Else, an instance of ReferenceMark is positionned either ‘before’ or ‘after’ provided regex.
If content is an ODF Element (ie: Paragraph, Span, …), the full inner content is referenced (of the position just after if content is a single empty tag).
If content/before or after exists (regex) and return a group of matching positions, the position value is the index of matching place to use.
Name is mandatory and shall be unique in the document for the preference mark range.
Arguments:
name -- str
before -- str regular expression or None
after -- str regular expression or None,
content -- str regular expression or None, or Element
position -- int or tuple of int
Return: the created ReferenceMark or ReferenceMarkStart
Source code in odfdo/paragraph.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
|
set_reference_mark_end(reference_mark, before=None, after=None, position=0)
Insert/move a ReferenceMarkEnd for an existing reference mark. If some end tag already exists, replace it. Reference tag is set at the position defined by the regex (before or after).
If content/before or after (regex) returns a group of matching positions, the position value is the index of matching place to use.
Arguments:
reference_mark -- ReferenceMark or ReferenceMarkStart (mandatory)
before -- str regular expression or None
after -- str regular expression or None
position -- int
Source code in odfdo/paragraph.py
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
|
set_span(match, tail, style, regex=None, offset=None, length=0)
set_span(style, regex=None, offset=None, length=0) Apply the given style to text content matching the regex OR the positional arguments offset and length.
(match, tail: provided by regex decorator)
Arguments:
style -- str
regex -- str regular expression
offset -- int
length -- int
Source code in odfdo/paragraph.py
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 |
|
Presentation
Bases: Body
Presentation, specialized class of Element in charge of actual content management.
Source code in odfdo/body.py
128 129 130 131 132 133 134 |
|
RectangleShape
Bases: ShapeBase
Create a rectangle shape.
Arguments:
style -- str
text_style -- str
draw_id -- str
layer -- str
position -- (str, str)
size -- (str, str)
Source code in odfdo/shapes.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
Reference
Bases: Element
A reference to a content marked by a reference mark. The odf_reference element (“text:reference-ref”) represents a field that references a “text:reference-mark-start” or “text:reference-mark” element. Its text:reference-format attribute specifies what is displayed from the referenced element. Default is ‘page’ Actual content is not updated except for the ‘text’ format by the update() method.
Creation of references can be tricky, consider using this method: odfdo.paragraph.insert_reference()
Values for text:reference-format : The defined values for the text:reference-format attribute supported by all reference fields are: - ‘chapter’: displays the number of the chapter in which the referenced item appears. - ‘direction’: displays whether the referenced item is above or below the reference field. - ‘page’: displays the number of the page on which the referenced item appears. - ‘text’: displays the text of the referenced item. Additional defined values for the text:reference-format attribute supported by references to sequence fields are: - ‘caption’: displays the caption in which the sequence is used. - ‘category-and-value’: displays the name and value of the sequence. - ‘value’: displays the value of the sequence.
References to bookmarks and other references support additional values,
which display the list label of the referenced item. If the referenced
item is contained in a list or a numbered paragraph, the list label is
the formatted number of the paragraph which contains the referenced
item. If the referenced item is not contained in a list or numbered
paragraph, the list label is empty, and the referenced field therefore
displays nothing. If the referenced bookmark or reference contains more
than one paragraph, the list label of the paragraph at which the
bookmark or reference starts is taken.
Additional defined values for the text:reference-format attribute
supported by all references to bookmark's or other reference fields
are:
- 'number': displays the list label of the referenced item. [...]
- 'number-all-superior': displays the list label of the referenced
item and adds the contents of all list labels of superior levels
in front of it. [...]
- 'number-no-superior': displays the contents of the list label of
the referenced item.
Source code in odfdo/reference.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
__init__(name='', ref_format='', **kwargs)
Create a reference to a content marked by a reference mark. An actual reference mark with the provided name should exist.
Consider using: odfdo.paragraph.insert_reference()
The text:ref-name attribute identifies a “text:reference-mark” or “text:referencemark-start” element by the value of that element’s text:name attribute. If ref_format is ‘text’, the current text content of the reference_mark is retrieved.
Arguments:
name -- str : name of the reference mark
ref_format -- str : format of the field. Default is 'page', allowed
values are 'chapter', 'direction', 'page', 'text',
'caption', 'category-and-value', 'value', 'number',
'number-all-superior', 'number-no-superior'.
Source code in odfdo/reference.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
update()
Update the content of the reference text field. Currently only ‘text’ format is implemented. Other values, for example the ‘page’ text field, may need to be refreshed through a visual ODF parser.
Source code in odfdo/reference.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
ReferenceMark
Bases: Element
A point reference. A point reference marks a position in text and is represented by a single “text:reference-mark” element.
Source code in odfdo/reference.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
__init__(name='', **kwargs)
A point reference. A point reference marks a position in text and is represented by a single “text:reference-mark” element. Consider using the wrapper: odfdo.paragraph.set_reference_mark()
Arguments:
name -- str
Source code in odfdo/reference.py
200 201 202 203 204 205 206 207 208 209 210 211 |
|
ReferenceMarkEnd
Bases: Element
The “text:reference-mark-end” element represents the end of a range reference.
Source code in odfdo/reference.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
__init__(name='', **kwargs)
The “text:reference-mark-end” element represent the end of a range reference. Consider using the wrappers: odfdo.paragraph.set_reference_mark() and odfdo.paragraph.set_reference_mark_end()
Arguments:
name -- str
Source code in odfdo/reference.py
225 226 227 228 229 230 231 232 233 234 235 236 237 |
|
referenced_text()
Return the text between reference-mark-start and reference-mark-end.
Source code in odfdo/reference.py
239 240 241 242 243 244 245 246 247 248 |
|
ReferenceMarkStart
Bases: Element
The “text:reference-mark-start” element represents the start of a range reference.
Source code in odfdo/reference.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
|
__init__(name='', **kwargs)
The “text:reference-mark-start” element represent the start of a range reference. Consider using the wrapper: odfdo.paragraph.set_reference_mark()
Arguments:
name -- str
Source code in odfdo/reference.py
262 263 264 265 266 267 268 269 270 271 272 273 |
|
delete(child=None, keep_tail=True)
Delete the given element from the XML tree. If no element is given, “self” is deleted. The XML library may allow to continue to use an element now “orphan” as long as you have a reference to it.
For odf_reference_mark_start : delete the reference-end tag if exists.
Arguments:
child -- Element
keep_tail -- boolean (default to True), True for most usages.
Source code in odfdo/reference.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
|
get_referenced(no_header=False, clean=True, as_xml=False, as_list=False)
Return the document content between the start and end tags of the reference. The content returned by this method can spread over several headers and paragraphs. By default, the content is returned as an “office:text” odf element.
Arguments:
no_header -- boolean (default to False), translate existing headers
tags "text:h" into paragraphs "text:p".
clean -- boolean (default to True), suppress unwanted tags. Striped
tags are : 'text:change', 'text:change-start',
'text:change-end', 'text:reference-mark',
'text:reference-mark-start', 'text:reference-mark-end'.
as_xml -- boolean (default to False), format the returned content as
a XML string (serialization).
as_list -- boolean (default to False), do not embed the returned
content in a "office:text'" element, instead simply
return a raw list of odf elements.
Source code in odfdo/reference.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
|
referenced_text()
Return the text between reference-mark-start and reference-mark-end.
Source code in odfdo/reference.py
275 276 277 278 279 280 281 282 283 284 |
|
Row
Bases: CachedElement
ODF table row “table:table-row”
Source code in odfdo/row.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
|
cells
property
Get the list of all cells.
Return: list of Cell
repeated
property
writable
Get / set the number of times the row is repeated.
Always None when using the table API.
Return: int or None
style
property
writable
Get /set the style of the row itself.
Return: str
width
property
Get the number of expected cells in the row, i.e. addition repetitions.
Return: int
__init__(width=None, repeated=None, style=None, **kwargs)
create a Row, optionally filled with “width” number of cells.
Rows contain cells, their number determine the number of columns.
You don’t generally have to create rows by hand, use the Table API.
Arguments:
width -- int
repeated -- int
style -- str
Source code in odfdo/row.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
append_cell(cell=None, clone=True, _repeated=None)
Append the given cell at the end of the row. Repeated cells are accepted. If no cell is given, an empty one is created.
Do not use when working on a table, use Table.append_cell().
Arguments:
cell -- Cell
_repeated -- (optional), repeated value of the row
returns the cell with x and y updated
Source code in odfdo/row.py
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 |
|
delete_cell(x)
Delete the cell at the given position “x” starting from 0. Alphabetical positions like “D” are accepted.
Cells on the right will be shifted to the left. In a table, other rows remain unaffected.
Arguments:
x -- int or str
Source code in odfdo/row.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
|
force_width(width)
Change the repeated property of the last cell of the row to comply with the required max width.
Arguments:
width -- int
Source code in odfdo/row.py
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 |
|
get_cell(x, clone=True)
Get the cell at position “x” starting from 0. Alphabetical positions like “D” are accepted.
A copy is returned, use set_cell() to push it back.
Arguments:
x -- int or str
Return: Cell | None
Source code in odfdo/row.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
|
get_cells(coord=None, style=None, content=None, cell_type=None)
Get the list of cells matching the criteria.
Filter by cell_type, with cell_type ‘all’ will retrieve cells of any type, aka non empty cells.
Filter by coordinates will retrieve the amount of cells defined by ‘coord’, minus the other filters.
Arguments:
coord -- str or tuple of int : coordinates
cell_type -- 'boolean', 'float', 'date', 'string', 'time',
'currency', 'percentage' or 'all'
content -- str regex
style -- str
Return: list of Cell
Source code in odfdo/row.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
|
get_sub_elements()
Shortcut to get the Elements inside cells in this row.
Missing values are replaced by None. Cell type should be always ‘string’ when using this method, the length of the list is equal to the length of the row.
Return: list of Elements.
Source code in odfdo/row.py
652 653 654 655 656 657 658 659 660 661 662 663 |
|
get_value(x, get_type=False)
Shortcut to get the value of the cell at position “x”. If get_type is True, returns the tuples (value, ODF type).
If the cell is empty, returns None or (None, None)
See get_cell() and Cell.get_value().
Source code in odfdo/row.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
|
get_values(coord=None, cell_type=None, complete=False, get_type=False)
Shortcut to get the cell values in this row.
Filter by cell_type, with cell_type ‘all’ will retrieve cells of any type, aka non empty cells. If cell_type is used and complete is True, missing values are replaced by None. If cell_type is None, complete is always True : with no cell type queried, get_values() returns None for each empty cell, the length of the list is equal to the length of the row (depending on coordinates use).
If get_type is True, returns a tuple (value, ODF type of value), or (None, None) for empty cells if complete is True.
Filter by coordinates will retrieve the amount of cells defined by coordinates with None for empty cells, except when using cell_type.
Arguments:
coord -- str or tuple of int : coordinates in row
cell_type -- 'boolean', 'float', 'date', 'string', 'time',
'currency', 'percentage' or 'all'
complete -- boolean
get_type -- boolean
Return: list of Python types, or list of tuples.
Source code in odfdo/row.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
|
insert_cell(x, cell=None, clone=True)
Insert the given cell at position “x” starting from 0. If no cell is given, an empty one is created.
Alphabetical positions like “D” are accepted.
Do not use when working on a table, use Table.insert_cell().
Arguments:
x -- int or str
cell -- Cell
returns the cell with x and y updated
Source code in odfdo/row.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
|
is_empty(aggressive=False)
Return whether every cell in the row has no value or the value evaluates to False (empty string), and no style.
If aggressive is True, empty cells with style are considered empty.
Arguments:
aggressive -- bool
Return: bool
Source code in odfdo/row.py
827 828 829 830 831 832 833 834 835 836 837 838 839 |
|
last_cell()
Return the las cell of the row.
Return Cell | None
Source code in odfdo/row.py
797 798 799 800 801 802 803 804 805 |
|
minimized_width()
Return the length of the row if the last repeated sequence is reduced to one.
Return: int
Source code in odfdo/row.py
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 |
|
rstrip(aggressive=False)
Remove in-place empty cells at the right of the row. An empty cell has no value but can have style. If “aggressive” is True, style is ignored.
Arguments:
aggressive -- bool
Source code in odfdo/row.py
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 |
|
set_cell(x, cell=None, clone=True)
Push the cell back in the row at position “x” starting from 0. Alphabetical positions like “D” are accepted.
Arguments:
x -- int or str
returns the cell with x and y updated
Source code in odfdo/row.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
|
set_cells(cells=None, start=0, clone=True)
Set the cells in the row, from the ‘start’ column. This method does not clear the row, use row.clear() before to start with an empty row.
Arguments:
cells -- list of cells
start -- int or str
Source code in odfdo/row.py
665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 |
|
set_value(x, value, style=None, cell_type=None, currency=None)
Shortcut to set the value of the cell at position “x”.
Arguments:
x -- int or str
value -- Python type
cell_type -- 'boolean', 'currency', 'date', 'float', 'percentage',
'string' or 'time'
currency -- three-letter str
style -- str
See get_cell() and Cell.get_value().
Source code in odfdo/row.py
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 |
|
set_values(values, start=0, style=None, cell_type=None, currency=None)
Shortcut to set the value of cells in the row, from the ‘start’ column vith values. This method does not clear the row, use row.clear() before to start with an empty row.
Arguments:
values -- list of Python types
start -- int or str
cell_type -- 'boolean', 'float', 'date', 'string', 'time',
'currency' or 'percentage'
currency -- three-letter str
style -- cell style
Source code in odfdo/row.py
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 |
|
traverse(start=None, end=None)
Yield as many cell elements as expected cells in the row, i.e. expand repetitions by returning the same cell as many times as necessary.
Arguments:
start -- int
end -- int
Copies are returned, use set_cell() to push them back.
Source code in odfdo/row.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
|
RowGroup
Bases: Element
“table:table-row-group” group rows with common properties.
Source code in odfdo/table.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
__init__(height=None, width=None, **kwargs)
Create a group of rows, optionnaly filled with “height” number of rows, of “width” cells each.
Row group bear style information applied to a series of rows.
Arguments:
height -- int
width -- int
Source code in odfdo/table.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
Section
Bases: Element
ODF section “text:section”
Arguments:
style -- str
name -- str
Source code in odfdo/section.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
Spacer
Bases: MDSpacer
, Element
This element shall be used to represent the second and all following “ “ (U+0020, SPACE) characters in a sequence of “ “ (U+0020, SPACE) characters. Note: It is not an error if the character preceding the element is not a white space character, but it is good practice to use this element only for the second and all following SPACE characters in a sequence.
Source code in odfdo/paragraph_base.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
text
property
writable
Get / set the text content of the element.
__init__(number=1, **kwargs)
Arguments:
number -- int
Source code in odfdo/paragraph_base.py
177 178 179 180 181 182 183 184 185 186 187 188 |
|
Span
Bases: MDSpan
, Paragraph
Specialised paragraph for span “text:span”.
Source code in odfdo/paragraph.py
969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 |
|
__init__(text=None, style=None, formatted=True, **kwargs)
Create a span element “text:span” of the given style containing the optional given text.
If “formatted” is True (the default), the given text is appended with
Arguments:
text -- str
style -- str
formatted -- bool
Source code in odfdo/paragraph.py
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 |
|
Spreadsheet
Bases: Body
Spreadsheet, specialized class of Element in charge of actual content management.
Source code in odfdo/body.py
137 138 139 140 141 142 143 |
|
Style
Bases: Element
Style class for all these tags:
‘style:style’ ‘number:date-style’, ‘number:number-style’, ‘number:percentage-style’, ‘number:time-style’ ‘style:font-face’, ‘style:master-page’, ‘style:page-layout’, ‘style:presentation-page-layout’, ‘text:list-style’, ‘text:outline-style’, ‘style:tab-stops’, …
Source code in odfdo/style.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 |
|
__init__(family=None, name=None, display_name=None, parent_style=None, area=None, color=None, background_color=None, italic=False, bold=False, master_page=None, page_layout=None, next_style=None, data_style=None, border=None, border_top=None, border_right=None, border_bottom=None, border_left=None, padding=None, padding_top=None, padding_bottom=None, padding_left=None, padding_right=None, shadow=None, height=None, use_optimal_height=False, width=None, break_before=None, break_after=None, min_height=None, font_name=None, font_family=None, font_family_generic=None, font_pitch='variable', **kwargs)
Create a style of the given family. The name is not mandatory at this point but will become required when inserting in a document as a common style.
The display name is the name the user sees in an office application.
The parent_style is the name of the style this style will inherit from.
To set properties, pass them as keyword arguments. The area properties apply to is optional and defaults to the family.
Arguments:
family -- 'paragraph', 'text', 'section', 'table', 'table-column',
'table-row', 'table-cell', 'table-page', 'chart',
'drawing-page', 'graphic', 'presentation',
'control', 'ruby', 'list', 'number', 'page-layout'
'font-face', or 'master-page'
name -- str
display_name -- str
parent_style -- str
area -- str
‘text’ Properties:
italic -- bool
bold -- bool
‘paragraph’ Properties:
master_page -- str
‘master-page’ Properties:
page_layout -- str
next_style -- str
‘table-cell’ Properties:
border, border_top, border_right, border_bottom, border_left -- str,
e.g. "0.002cm solid #000000" or 'none'
padding, padding_top, padding_right, padding_bottom, padding_left -- str,
e.g. "0.002cm" or 'none'
shadow -- str, e.g. "#808080 0.176cm 0.176cm"
‘table-row’ Properties:
height -- str, e.g. '5cm'
use_optimal_height -- bool
‘table-column’ Properties:
width -- str, e.g. '5cm'
break_before -- 'page', 'column' or 'auto'
break_after -- 'page', 'column' or 'auto'
Source code in odfdo/style.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 |
|
del_properties(properties=None, area=None)
Delete the given properties, either by list argument or positional argument (or both). Remove only from the given area, identical to the style family by default.
Arguments:
properties -- list
area -- str
Source code in odfdo/style.py
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
|
get_list_style_properties()
Get text properties of style as a dict, with some enhanced values.
Enhanced values returned
- “color”: str
- “background_color”: str
- “italic”: bool
- “bold”: bool
- “fixed”: bool
- “underline”: bool
- “strike”: bool
Return: dict[str, str | bool]
Source code in odfdo/style.py
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 |
|
get_page_footer()
Get the element that contains the footer contents.
If None, no footer was set.
Source code in odfdo/style.py
1008 1009 1010 1011 1012 1013 1014 1015 |
|
get_page_header()
Get the element that contains the header contents.
If None, no header was set.
Source code in odfdo/style.py
981 982 983 984 985 986 987 988 |
|
get_properties(area=None)
Get the mapping of all properties of this style. By default the properties of the same family, e.g. a paragraph style and its paragraph properties. Specify the area to get the text properties of a paragraph style for example.
Arguments:
area -- str
Return: dict
Source code in odfdo/style.py
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 |
|
get_text_properties()
Get text properties of style as a dict, with some enhanced values.
Enhanced values returned
- “color”: str
- “background_color”: str
- “italic”: bool
- “bold”: bool
- “fixed”: bool
- “underline”: bool
- “strike”: bool
Return: dict[str, str | bool]
Source code in odfdo/style.py
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 |
|
set_background(color=None, url=None, position='center', repeat=None, opacity=None, filter=None)
Set the background color of a text style, or the background color or image of a paragraph style or page layout.
With no argument, remove any existing background.
The position is one or two of ‘center’, ‘left’, ‘right’, ‘top’ or ‘bottom’.
The repeat is ‘no-repeat’, ‘repeat’ or ‘stretch’.
The opacity is a percentage integer (not a string with the ‘%s’ sign)
The filter is an application-specific filter name defined elsewhere.
Though this method is defined on the base style class, it will raise an error if the style type is not compatible.
Arguments:
color -- '#rrggbb'
url -- str
position -- str
repeat -- str
opacity -- int
filter -- str
Source code in odfdo/style.py
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 |
|
set_level_style(level, num_format=None, bullet_char=None, url=None, display_levels=None, prefix=None, suffix=None, start_value=None, style=None, clone=None)
Arguments:
level -- int
num_format (for number) -- int
bullet_char (for bullet) -- str
url (for image) -- str
display_levels -- int
prefix -- str
suffix -- str
start_value -- int
style -- str
clone -- List Style
Return
level_style created
Source code in odfdo/style.py
822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 |
|
set_page_footer(text_or_element)
Create or replace the footer by the given content. It can already be a complete footer.
If you only want to update the existing footer, get it and use the API.
Arguments:
text_or_element -- str or Element or a list of them
Source code in odfdo/style.py
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 |
|
set_page_header(text_or_element)
Create or replace the header by the given content. It can already be a complete header.
If you only want to update the existing header, get it and use the API.
Arguments:
text_or_element -- str or Element or a list of them
Source code in odfdo/style.py
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 |
|
set_properties(properties=None, style=None, area=None, **kwargs)
Set the properties of the “area” type of this style. Properties are given either as a dict or as named arguments (or both). The area is identical to the style family by default. If the properties element is missing, it is created.
Instead of properties, you can pass a style with properties of the same area. These will be copied.
Arguments:
properties -- dict
style -- Style
area -- 'paragraph', 'text'...
Source code in odfdo/style.py
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
|
Styles
Bases: XmlPart
Source code in odfdo/styles.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
get_style(family, name_or_element=None, display_name=None)
Return the style uniquely identified by the name/family pair. If the argument is already a style object, it will return it.
If the name is None, the default style is fetched.
If the name is not the internal name but the name you gave in the desktop application, use display_name instead.
Arguments:
family -- 'paragraph', 'text', 'graphic', 'table', 'list',
'number', 'page-layout', 'master-page'
name_or_element -- str, odf_style or None
display_name -- str or None
Return: odf_style or None if not found
Source code in odfdo/styles.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
get_styles(family='', automatic=False)
Return the list of styles in the Content part, optionally limited to the given family, optionaly limited to automatic styles.
Arguments:
family -- str
automatic -- bool
Return: list of Style
Source code in odfdo/styles.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
TOC
Bases: MDToc
, Element
Table of content. The “text:table-of-content” element represents a table of contents for a document. The items that can be listed in a table of contents are: - Headings (as defined by the outline structure of the document), up to a selected level. - Table of contents index marks. - Paragraphs formatted with specified paragraph styles.
Implementation: Default parameters are what most people use: protected from manual modifications and not limited in title levels.
The name is mandatory and derived automatically from the title if not given. Provide one in case of a conflict with other TOCs in the same document.
The “text:table-of-content” element has the following attributes: text:name, text:protected, text:protection-key, text:protection-key-digest-algorithm, text:style-name and xml:id.
Arguments:
title -- str
name -- str
protected -- bool
outline_level -- int
style -- str
title_style -- str
entry_style -- str
Source code in odfdo/toc.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
fill(document=None, use_default_styles=True)
Fill the TOC with the titles found in the document. A TOC is not contextual so it will catch all titles before and after its insertion. If the TOC is not attached to a document, attach it beforehand or provide one as argument.
For having a pretty TOC, let use_default_styles by default.
Arguments:
document -- Document
use_default_styles -- bool
Source code in odfdo/toc.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
Tab
Bases: MDTab
, Element
This element represents the [UNICODE] tab character (HORIZONTAL TABULATION, U+0009).
The position attribute contains the number of the tab-stop to which a tab character refers. The position 0 marks the start margin of a paragraph. Note: The position attribute is only a hint to help non-layout oriented consumers to determine the tab/tab-stop association. Layout oriented consumers should determine the tab positions based on the style information
Source code in odfdo/paragraph_base.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
__init__(position=None, **kwargs)
Arguments:
position -- int
Source code in odfdo/paragraph_base.py
240 241 242 243 244 245 246 247 248 |
|
TabStopStyle
Bases: Element
ODF “style:tab-stop” Base style for a TOC entryBase style for a TOC entry
Source code in odfdo/toc.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
Table
Bases: MDTable
, CachedElement
ODF table “table:table”
Source code in odfdo/table.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 |
|
cells
property
Get all cells of the table.
Return: list of list of Cell
columns
property
Get the list of all columns matching the criteria.
Copies are returned, use set_column() to push them back.
Return: list of columns
height
property
Get the current height of the table.
Return: int
name
property
writable
Get / set the name of the table.
The “name” parameter is required and cannot contain []*?:/ or \ characters, ’ (apostrophe) cannot be the first or last character.
rows
property
Get the list of all rows.
Return: list of rows
size
property
Shortcut to get the current width and height of the table.
Return: (int, int)
style
property
writable
Get / set the style of the table
Return: str
width
property
Get the current width of the table, measured on columns.
Rows may have different widths, use the Table API to ensure width consistency.
Return: int
__init__(name=None, width=None, height=None, protected=False, protection_key=None, printable=True, print_ranges=None, style=None, **kwargs)
Create a table element, optionally prefilled with “height” rows of “width” cells each.
The “name” parameter is required and cannot contain []*?:/ or \ characters, ’ (apostrophe) cannot be the first or last character.
If the table is to be protected, a protection key must be provided, i.e. a hash value of the password.
If the table must not be printed, set “printable” to False. The table will not be printed when it is not displayed, whatever the value of this argument.
Ranges of cells to print can be provided as a list of cell ranges, e.g. [‘E6:K12’, ‘P6:R12’] or directly as a raw string, e.g. “E6:K12 P6:R12”.
You can access and modify the XML tree manually, but you probably want to use the API to access and alter cells. It will save you from handling repetitions and the same number of cells for each row.
If you use both the table API and the XML API, you are on your own for ensuiring model integrity.
Arguments:
name -- str
width -- int
height -- int
protected -- bool
protection_key -- str
printable -- bool
print_ranges -- list
style -- str
Source code in odfdo/table.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
|
append(something)
Dispatch .append() call to append_row() or append_column().
Source code in odfdo/table.py
752 753 754 755 756 757 758 759 760 |
|
append_cell(y, cell=None, clone=True)
Append the given cell at the “y” coordinate. Repeated cells are accepted. If no cell is given, an empty one is created.
Position start at 0. So cell A4 is on row 3.
Other rows remain untouched.
Arguments:
y -- int or str
cell -- Cell
returns the cell with x and y updated
Source code in odfdo/table.py
2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 |
|
append_column(column=None, _repeated=None)
Append the column at the end of the table. If no column is given, an empty one is created.
ODF columns don’t contain cells, only style information.
Position start at 0. So cell C4 is on column 2. Alphabetical position like “C” is accepted.
Arguments:
column -- Column
Source code in odfdo/table.py
2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 |
|
append_row(row=None, clone=True, _repeated=None)
Append the row at the end of the table. If no row is given, an empty one is created.
Position start at 0. So cell A4 is on row 3.
Note the columns are automatically created when the first row is inserted in an empty table. So better insert a filled row.
Arguments:
row -- Row
_repeated -- (optional), repeated value of the row
returns the row, with updated row.y
Source code in odfdo/table.py
1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 |
|
del_span(area)
Delete a Cell Span. ‘area’ is the cell coordiante of the upper left cell of the spanned area.
Area can be either one cell (like ‘A1’) or an area (‘A1:B2’). It can be provided as an alpha numeric value like “A1:B2’ or a tuple like (0, 0, 1, 1) or (0, 0). If an area is provided, the upper left cell is used.
Arguments:
area -- str or tuple of int, cell or area coordinate
Source code in odfdo/table.py
2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 |
|
delete_cell(coord)
Delete the cell at the given coordinates, so that next cells are shifted to the left.
Coordinates are either a 2-uplet of (x, y) starting from 0, or a human-readable position like “C4”.
Use set_value() for erasing value.
Arguments:
coord -- (int, int) or str
Source code in odfdo/table.py
2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 |
|
delete_column(x)
Delete the column at the given position. ODF columns don’t contain cells, only style information.
Position start at 0. So cell C4 is on column 2. Alphabetical position like “C” is accepted.
Arguments:
x -- int or str
Source code in odfdo/table.py
2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 |
|
delete_named_range(name)
Delete the Named Range of specified name from the spreadsheet. Beware : named ranges are stored at the body level, thus do not call this method on a cloned table.
Arguments:
name -- str
Source code in odfdo/table.py
2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 |
|
delete_row(y)
Delete the row at the given “y” position.
Position start at 0. So cell A4 is on row 3.
Arguments:
y -- int or str
Source code in odfdo/table.py
1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 |
|
extend_rows(rows=None)
Append a list of rows at the end of the table.
Arguments:
rows -- list of Row
Source code in odfdo/table.py
1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 |
|
get_cell(coord, clone=True, keep_repeated=True)
Get the cell at the given coordinates.
They are either a 2-uplet of (x, y) starting from 0, or a human-readable position like “C4”.
A copy is returned, use set_cell
to push it back.
Arguments:
coord -- (int, int) or str
Return: Cell
Source code in odfdo/table.py
1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 |
|
get_cells(coord=None, cell_type=None, style=None, content=None, flat=False)
Get the cells matching the criteria. If ‘coord’ is None, parse the whole table, else parse the area defined by ‘coord’.
Filter by cell_type = “all” will retrieve cells of any type, aka non empty cells.
If flat is True (default is False), the method return a single list of all the values, else a list of lists of cells.
if cell_type, style and content are None, get_cells() will return the exact number of cells of the area, including empty cells.
Arguments:
coordinates -- str or tuple of int : coordinates of area
cell_type -- 'boolean', 'float', 'date', 'string', 'time',
'currency', 'percentage' or 'all'
content -- str regex
style -- str
flat -- boolean
Return: list of list of Cell
Source code in odfdo/table.py
1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 |
|
get_column(x)
Get the column at the given “x” position.
ODF columns don’t contain cells, only style information.
Position start at 0. So cell C4 is on column 2. Alphabetical position like “C” is accepted.
A copy is returned, use set_column() to push it back.
Arguments:
x -- int or str
Return: Column
Source code in odfdo/table.py
2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 |
|
get_column_cells(x, style=None, content=None, cell_type=None, complete=False)
Get the list of cells at the given position.
Position start at 0. So cell C4 is on column 2. Alphabetical position like “C” is accepted.
Filter by cell_type, with cell_type ‘all’ will retrieve cells of any type, aka non empty cells.
If complete is True, replace missing values by None.
Arguments:
x -- int or str
cell_type -- 'boolean', 'float', 'date', 'string', 'time',
'currency', 'percentage' or 'all'
content -- str regex
style -- str
complete -- boolean
Return: list of Cell
Source code in odfdo/table.py
2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 |
|
get_column_values(x, cell_type=None, complete=True, get_type=False)
Shortcut to get the list of Python values for the cells at the given position.
Position start at 0. So cell C4 is on column 2. Alphabetical position like “C” is accepted.
Filter by cell_type, with cell_type ‘all’ will retrieve cells of any type, aka non empty cells. If cell_type and complete is True, replace missing values by None.
If get_type is True, returns a tuple (value, ODF type of value)
Arguments:
x -- int or str
cell_type -- 'boolean', 'float', 'date', 'string', 'time',
'currency', 'percentage' or 'all'
complete -- boolean
get_type -- boolean
Return: list of Python types
Source code in odfdo/table.py
2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 |
|
get_columns(coord=None, style=None)
Get the list of columns matching the criteria.
Copies are returned, use set_column() to push them back.
Arguments:
coord -- str or tuple of int : coordinates of columns
style -- str
Return: list of columns
Source code in odfdo/table.py
2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 |
|
get_named_range(name)
Returns the Name Ranges of the specified name. If table_name is provided, limits the search to these tables. Beware : named ranges are stored at the body level, thus do not call this method on a cloned table.
Arguments:
name -- str, name of the named range object
Return : NamedRange
Source code in odfdo/table.py
2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 |
|
get_named_ranges(table_name=None)
Returns the list of available Name Ranges of the spreadsheet. If table_name is provided, limits the search to these tables. Beware : named ranges are stored at the body level, thus do not call this method on a cloned table.
Arguments:
table_names -- str or list of str, names of tables
Return : list of table_range
Source code in odfdo/table.py
2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 |
|
get_row(y, clone=True, create=True)
Get the row at the given “y” position.
Position start at 0. So cell A4 is on row 3.
A copy is returned, use set_cell() to push it back.
Arguments:
y -- int or str
Return: Row
Source code in odfdo/table.py
1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 |
|
get_row_sub_elements(y)
Shortcut to get the list of Elements values for the cells of the row at the given “y” position.
Position start at 0. So cell A4 is on row 3.
Missing values replaced by None.
Arguments:
y -- int, str
Return: list of lists of Elements
Source code in odfdo/table.py
1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 |
|
get_row_values(y, cell_type=None, complete=True, get_type=False)
Shortcut to get the list of Python values for the cells of the row at the given “y” position.
Position start at 0. So cell A4 is on row 3.
Filter by cell_type, with cell_type ‘all’ will retrieve cells of any type, aka non empty cells. If cell_type and complete is True, replace missing values by None.
If get_type is True, returns a tuple (value, ODF type of value)
Arguments:
y -- int, str
cell_type -- 'boolean', 'float', 'date', 'string', 'time',
'currency', 'percentage' or 'all'
complete -- boolean
get_type -- boolean
Return: list of lists of Python types
Source code in odfdo/table.py
1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 |
|
get_rows(coord=None, style=None, content=None)
Get the list of rows matching the criteria.
Filter by coordinates will parse the area defined by the coordinates.
Arguments:
coord -- str or tuple of int : coordinates of rows
content -- str regex
style -- str
Return: list of rows
Source code in odfdo/table.py
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 |
|
get_value(coord, get_type=False)
Shortcut to get the Python value of the cell at the given coordinates.
If get_type is True, returns the tuples (value, ODF type)
coord is either a 2-uplet of (x, y) starting from 0, or a human-readable position like “C4”. If an Area is given, the upper left position is used as coord.
Arguments:
coord -- (int, int) or str : coordinate
Return: Python type
Source code in odfdo/table.py
1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 |
|
get_values(coord=None, cell_type=None, complete=True, get_type=False, flat=False)
Get a matrix of values of the table.
Filter by coordinates will parse the area defined by the coordinates.
If ‘cell_type’ is used and ‘complete’ is True (default), missing values are replaced by None. Filter by ’ cell_type = “all” ’ will retrieve cells of any type, aka non empty cells.
If ‘cell_type’ is None, complete is always True : with no cell type queried, get_values() returns None for each empty cell, the length each lists is equal to the width of the table.
If get_type is True, returns tuples (value, ODF type of value), or (None, None) for empty cells with complete True.
If flat is True, the methods return a single list of all the values. By default, flat is False.
Arguments:
coord -- str or tuple of int : coordinates of area
cell_type -- 'boolean', 'float', 'date', 'string', 'time',
'currency', 'percentage' or 'all'
complete -- boolean
get_type -- boolean
Return: list of lists of Python types
Source code in odfdo/table.py
885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 |
|
insert_cell(coord, cell=None, clone=True)
Insert the given cell at the given coordinates. If no cell is given, an empty one is created.
Coordinates are either a 2-uplet of (x, y) starting from 0, or a human-readable position like “C4”.
Cells on the right are shifted. Other rows remain untouched.
Arguments:
coord -- (int, int) or str
cell -- Cell
returns the cell with x and y updated
Source code in odfdo/table.py
2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 |
|
insert_column(x, column=None)
Insert the column before the given “x” position. If no column is given, an empty one is created.
ODF columns don’t contain cells, only style information.
Position start at 0. So cell C4 is on column 2. Alphabetical position like “C” is accepted.
Arguments:
x -- int or str
column -- Column
Source code in odfdo/table.py
2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 |
|
insert_row(y, row=None, clone=True)
Insert the row before the given “y” position. If no row is given, an empty one is created.
Position start at 0. So cell A4 is on row 3.
If row is None, a new empty row is created.
Arguments:
y -- int or str
row -- Row
returns the row, with updated row.y
Source code in odfdo/table.py
1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 |
|
is_column_empty(x, aggressive=False)
Return wether every cell in the column at “x” position has no value or the value evaluates to False (empty string), and no style.
Position start at 0. So cell C4 is on column 2. Alphabetical position like “C” is accepted.
If aggressive is True, empty cells with style are considered empty.
Return: bool
Source code in odfdo/table.py
2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 |
|
is_empty(aggressive=False)
Return whether every cell in the table has no value or the value evaluates to False (empty string), and no style.
If aggressive is True, empty cells with style are considered empty.
Arguments:
aggressive -- bool
Source code in odfdo/table.py
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 |
|
is_row_empty(y, aggressive=False)
Return wether every cell in the row at the given “y” position has no value or the value evaluates to False (empty string), and no style.
Position start at 0. So cell A4 is on row 3.
If aggressive is True, empty cells with style are considered empty.
Arguments:
y -- int or str
aggressive -- bool
Source code in odfdo/table.py
1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 |
|
iter_values(coord=None, cell_type=None, complete=True, get_type=False)
Iterate through lines of Python values of the table.
Filter by coordinates will parse the area defined by the coordinates.
cell_type, complete, grt_type : see get_values()
Arguments:
coord -- str or tuple of int : coordinates of area
cell_type -- 'boolean', 'float', 'date', 'string', 'time',
'currency', 'percentage' or 'all'
complete -- boolean
get_type -- boolean
Return: iterator of lists
Source code in odfdo/table.py
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 |
|
optimize_width()
Remove in-place empty rows below and empty cells at the right of the table. Keep repeated styles of empty cells but minimize row width.
Source code in odfdo/table.py
1120 1121 1122 1123 1124 1125 1126 1127 |
|
rstrip(aggressive=False)
Remove in-place empty rows below and empty cells at the right of the table. Cells are empty if they contain no value or it evaluates to False, and no style.
If aggressive is True, empty cells with style are removed too.
Argument:
aggressive -- bool
Source code in odfdo/table.py
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 |
|
set_cell(coord, cell=None, clone=True)
Replace a cell of the table at the given coordinates.
They are either a 2-uplet of (x, y) starting from 0, or a human-readable position like “C4”.
Arguments:
coord -- (int, int) or str : coordinate
cell -- Cell
return the cell, with x and y updated
Source code in odfdo/table.py
1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 |
|
set_cell_image(coord, image_frame, doc_type=None)
Do all the magic to display an image in the cell at the given coordinates.
They are either a 2-uplet of (x, y) starting from 0, or a human-readable position like “C4”.
The frame element must contain the expected image position and dimensions.
DrawImage insertion depends on the document type, so the type must be provided or the table element must be already attached to a document.
Arguments:
coord -- (int, int) or str
image_frame -- Frame including an image
doc_type -- 'spreadsheet' or 'text'
Source code in odfdo/table.py
1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 |
|
set_cells(cells, coord=None, clone=True)
Set the cells in the table, from the ‘coord’ position.
‘coord’ is the coordinate of the upper left cell to be modified by values. If ‘coord’ is None, default to the position (0,0) (“A1”). If ‘coord’ is an area (e.g. “A2:B5”), the upper left position of this area is used as coordinate.
The table is not cleared before the operation, to reset the table before setting cells, use table.clear().
A list of lists is expected, with as many lists as rows to be set, and as many cell in each sublist as cells to be setted in the row.
Arguments:
cells -- list of list of cells
coord -- tuple or str
values -- list of lists of python types
Source code in odfdo/table.py
1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 |
|
set_column(x, column=None)
Replace the column at the given “x” position.
ODF columns don’t contain cells, only style information.
Position start at 0. So cell C4 is on column 2. Alphabetical position like “C” is accepted.
Arguments:
x -- int or str
column -- Column
Source code in odfdo/table.py
2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 |
|
set_column_cells(x, cells)
Shortcut to set the list of cells at the given position.
Position start at 0. So cell C4 is on column 2. Alphabetical position like “C” is accepted.
The list must have the same length than the table height.
Arguments:
x -- int or str
cells -- list of Cell
Source code in odfdo/table.py
2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 |
|
set_column_values(x, values, cell_type=None, currency=None, style=None)
Shortcut to set the list of Python values of cells at the given position.
Position start at 0. So cell C4 is on column 2. Alphabetical position like “C” is accepted.
The list must have the same length than the table height.
Arguments:
x -- int or str
values -- list of Python types
cell_type -- 'boolean', 'currency', 'date', 'float', 'percentage',
'string' or 'time'
currency -- three-letter str
style -- str
Source code in odfdo/table.py
2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 |
|
set_named_range(name, crange, table_name=None, usage=None)
Create a Named Range element and insert it in the document. Beware : named ranges are stored at the body level, thus do not call this method on a cloned table.
Arguments:
name -- str, name of the named range
crange -- str or tuple of int, cell or area coordinate
table_name -- str, name of the table
uage -- None or 'print-range', 'filter', 'repeat-column', 'repeat-row'
Source code in odfdo/table.py
2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 |
|
set_row(y, row=None, clone=True)
Replace the row at the given position with the new one. Repetions of the old row will be adjusted.
If row is None, a new empty row is created.
Position start at 0. So cell A4 is on row 3.
Arguments:
y -- int or str
row -- Row
returns the row, with updated row.y
Source code in odfdo/table.py
1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 |
|
set_row_cells(y, cells=None)
Shortcut to set all the cells of the row at the given “y” position.
Position start at 0. So cell A4 is on row 3.
Arguments:
y -- int or str
cells -- list of Python types
style -- str
returns the row, with updated row.y
Source code in odfdo/table.py
1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 |
|
set_row_values(y, values, cell_type=None, currency=None, style=None)
Shortcut to set the values of all cells of the row at the given “y” position.
Position start at 0. So cell A4 is on row 3.
Arguments:
y -- int or str
values -- list of Python types
cell_type -- 'boolean', 'currency', 'date', 'float', 'percentage',
'string' or 'time'
currency -- three-letter str
style -- str
returns the row, with updated row.y
Source code in odfdo/table.py
1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 |
|
set_span(area, merge=False)
Create a Cell Span : span the first cell of the area on several columns and/or rows. If merge is True, replace text of the cell by the concatenation of existing text in covered cells. Beware : if merge is True, old text is changed, if merge is False (the default), old text in coverd cells is still present but not displayed by most GUI.
If the area defines only one cell, the set span will do nothing. It is not allowed to apply set span to an area whose one cell already belongs to previous cell span.
Area can be either one cell (like ‘A1’) or an area (‘A1:B2’). It can be provided as an alpha numeric value like “A1:B2’ or a tuple like (0, 0, 1, 1) or (0, 0).
Arguments:
area -- str or tuple of int, cell or area coordinate
merge -- boolean
Source code in odfdo/table.py
2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 |
|
set_value(coord, value, cell_type=None, currency=None, style=None)
Set the Python value of the cell at the given coordinates.
They are either a 2-uplet of (x, y) starting from 0, or a human-readable position like “C4”.
Arguments:
coord -- (int, int) or str
value -- Python type
cell_type -- 'boolean', 'currency', 'date', 'float', 'percentage',
'string' or 'time'
currency -- three-letter str
style -- str
Source code in odfdo/table.py
1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 |
|
set_values(values, coord=None, style=None, cell_type=None, currency=None)
Set the value of cells in the table, from the ‘coord’ position with values.
‘coord’ is the coordinate of the upper left cell to be modified by values. If ‘coord’ is None, default to the position (0,0) (“A1”). If ‘coord’ is an area (e.g. “A2:B5”), the upper left position of this area is used as coordinate.
The table is not cleared before the operation, to reset the table before setting values, use table.clear().
A list of lists is expected, with as many lists as rows, and as many items in each sublist as cells to be setted. None values in the list will create empty cells with no cell type (but eventually a style).
Arguments:
coord -- tuple or str
values -- list of lists of python types
cell_type -- 'boolean', 'currency', 'date', 'float', 'percentage',
'string' or 'time'
currency -- three-letter str
style -- str
Source code in odfdo/table.py
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 |
|
to_csv(path_or_file=None, dialect='excel')
Write the table as CSV in the file.
If the file is a string, it is opened as a local path. Else an opened file-like is expected.
Arguments:
path_or_file -- str or file-like
dialect -- str, python csv.dialect, can be 'excel', 'unix'...
Source code in odfdo/table.py
2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 |
|
transpose(coord=None)
Swap in-place rows and columns of the table.
If ‘coord’ is not None, apply transpose only to the area defined by the coordinates. Beware, if area is not square, some cells mays be over written during the process.
Arguments:
coord -- str or tuple of int : coordinates of area
start -- int or str
Source code in odfdo/table.py
1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 |
|
traverse(start=None, end=None)
Yield as many row elements as expected rows in the table, i.e. expand repetitions by returning the same row as many times as necessary.
Arguments:
start -- int
end -- int
Copies are returned, use set_row() to push them back.
Source code in odfdo/table.py
1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 |
|
traverse_columns(start=None, end=None)
Yield as many column elements as expected columns in the table, i.e. expand repetitions by returning the same column as many times as necessary.
Arguments:
start -- int
end -- int
Copies are returned, use set_column() to push them back.
Source code in odfdo/table.py
2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 |
|
Text
Bases: Body
Text, specialized class of Element in charge of actual content management.
Source code in odfdo/body.py
146 147 148 149 150 151 152 |
|
TextChange
Bases: Element
The TextChange “text:change” element marks a position in an empty region where text has been deleted.
Source code in odfdo/tracked_changes.py
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 |
|
get_deleted(tracked_changes=None, as_text=False, no_header=False, clean=True)
Shortcut to get the deleted informations stored in the TextDeletion stored in the tracked changes.
Return: Paragraph (or None).”
Source code in odfdo/tracked_changes.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
|
get_end()
Return None.
Source code in odfdo/tracked_changes.py
558 559 560 |
|
get_inserted(as_text=False, no_header=False, clean=True)
Return None.
Source code in odfdo/tracked_changes.py
545 546 547 548 549 550 551 552 |
|
get_start()
Return None.
Source code in odfdo/tracked_changes.py
554 555 556 |
|
TextChangeEnd
Bases: TextChange
The TextChangeEnd “text:change-end” element marks the end of a region with content where text has been inserted or the format has been changed.
Source code in odfdo/tracked_changes.py
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 |
|
get_deleted(*args, **kwargs)
Return None.
Source code in odfdo/tracked_changes.py
586 587 588 |
|
get_end()
Return self.
Source code in odfdo/tracked_changes.py
582 583 584 |
|
get_inserted(as_text=False, no_header=False, clean=True)
Return the content between text:change-start and text:change-end.
If no content exists (deletion tag), returns None (or ‘’ if text flag is True). If as_text is True: returns the text content. If clean is True: suppress unwanted tags (deletions marks, …) If no_header is True: existing text:h are changed in text:p By default: returns a list of Element, cleaned and with headers
Arguments:
as_text -- boolean
clean -- boolean
no_header -- boolean
Return: list or Element or text
Source code in odfdo/tracked_changes.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 |
|
get_start()
Return the corresponding annotation starting tag or None.
Source code in odfdo/tracked_changes.py
571 572 573 574 575 576 577 578 579 580 |
|
TextChangeStart
Bases: TextChangeEnd
The TextChangeStart “text:change-start” element marks the start of a region with content where text has been inserted or the format has been changed.
Source code in odfdo/tracked_changes.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
|
delete(child=None, keep_tail=True)
Delete the given element from the XML tree. If no element is given, “self” is deleted. The XML library may allow to continue to use an element now “orphan” as long as you have a reference to it.
For TextChangeStart : delete also the end tag if exists.
Arguments:
child -- Element
keep_tail -- boolean (default to True), True for most usages.
Source code in odfdo/tracked_changes.py
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
|
get_end()
Return the corresponding change-end tag or None.
Source code in odfdo/tracked_changes.py
643 644 645 646 647 648 649 650 651 652 |
|
get_start()
Return self.
Source code in odfdo/tracked_changes.py
639 640 641 |
|
TextChangedRegion
Bases: Element
Each TextChangedRegion “text:changed-region” element contains a single element, one of TextInsertion, TextDeletion or TextFormatChange that corresponds to a change being tracked within the scope of the “text:tracked-changes” element that contains the “text:changed-region” instance. The xml:id attribute of the TextChangedRegion is referenced from the “text:change”, “text:change-start” and “text:change-end” elements that identify where the change applies to markup in the scope of the “text:tracked-changes” element.
for this implementation, text:change should be referenced only
once in the scope, which is different from ODF 1.2 requirement:
" A "text:changed-region" can be referenced by more than one
change, but the corresponding referencing change mark elements
shall be of the same change type - insertion, format change or
deletion. "
Source code in odfdo/tracked_changes.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
|
get_change_element()
Get the change element child. It can be either: TextInsertion, TextDeletion, or TextFormatChange as an Element object.
Return: Element.
Source code in odfdo/tracked_changes.py
384 385 386 387 388 389 390 391 392 393 394 395 |
|
get_change_info()
Shortcut to get the ChangeInfo element of the change element child.
Return: ChangeInfo element.
Source code in odfdo/tracked_changes.py
349 350 351 352 353 354 355 |
|
get_id()
Get the “text:id” attribute.
Return: str
Source code in odfdo/tracked_changes.py
409 410 411 412 413 414 |
|
set_change_info(change_info=None, creator=None, date=None, comments=None)
Shortcut to set the ChangeInfo element of the sub change element. See TextInsertion.set_change_info() for details.
Arguments:
change_info -- ChangeInfo element (or None)
cretor -- str (or None)
date -- datetime (or None)
comments -- Paragraph or list of Paragraph elements (or None)
Source code in odfdo/tracked_changes.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
|
set_id(idx)
Set both the “text:id” and “xml:id” attributes with same value.
Source code in odfdo/tracked_changes.py
416 417 418 419 |
|
TextDeletion
Bases: TextInsertion
The TextDeletion “text:deletion” contains information that identifies the person responsible for a deletion and the date of that deletion. This information may also contain one or more Paragraph which contains a comment on the deletion. The TextDeletion element may also contain content that was deleted while change tracking was enabled. The position where the text was deleted is marked by a “text:change” element. Deleted text is contained in a paragraph element. To reconstruct the original text, the paragraph containing the deleted text is merged with its surrounding paragraph or heading element. To reconstruct the text before a deletion took place: - If the change mark is inside a paragraph, insert the content that was deleted, but remove all leading start tags up to and including the first “text:p” element and all trailing end tags up to and including the last “/text:p” or “/text:h” element. If the last trailing element is a “/text:h”, change the end tag “/text:p” following this insertion to a “/text:h” element. - If the change mark is inside a heading, insert the content that was deleted, but remove all leading start tags up to and including the first “text:h” element and all trailing end tags up to and including the last “/text:h” or “/text:p” element. If the last trailing element is a “/text:p”, change the end tag “/text:h” following this insertion to a “/text:p” element. - Otherwise, copy the text content of the “text:deletion” element in place of the change mark.
Source code in odfdo/tracked_changes.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
get_deleted(as_text=False, no_header=False)
Get the deleted informations stored in the TextDeletion. If as_text is True: returns the text content. If no_header is True: existing Heading are changed in Paragraph
Arguments:
as_text -- boolean
no_header -- boolean
Return: Paragraph and Header list
Source code in odfdo/tracked_changes.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
get_inserted(as_text=False, no_header=False, clean=True)
Return None.
Source code in odfdo/tracked_changes.py
303 304 305 306 307 308 309 310 311 312 |
|
set_deleted(paragraph_or_list)
Set the deleted informations stored in the TextDeletion. An actual content that was deleted is expected, embeded in a Paragraph element or Header.
Arguments:
paragraph_or_list -- Paragraph or Header element (or list)
Source code in odfdo/tracked_changes.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
|
TextFormatChange
Bases: TextInsertion
The TextFormatChange “text:format-change” element represents any change in formatting attributes. The region where the change took place is marked by “text:change-start”, “text:change-end” or “text:change” elements.
Note: This element does not contain formatting changes that have taken place.
Source code in odfdo/tracked_changes.py
315 316 317 318 319 320 321 322 323 324 325 |
|
TextInsertion
Bases: Element
The TextInsertion “text:insertion” element contains the information that identifies the person responsible for a change and the date of that change. This information may also contain one or more “text:p” Paragraph which contain a comment on the insertion. The TextInsertion element’s parent “text:changed-region” element has an xml:id or text:id attribute, the value of which binds that parent element to the text:change-id attribute on the “text:change-start” and “text:change-end” elements.
Source code in odfdo/tracked_changes.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
get_change_info()
Get the ChangeInfo child of the element.
Return: ChangeInfo element.
Source code in odfdo/tracked_changes.py
165 166 167 168 169 170 |
|
get_deleted(as_text=False, no_header=False)
Return: None.
Source code in odfdo/tracked_changes.py
117 118 119 120 121 122 123 124 125 |
|
get_inserted(as_text=False, no_header=False, clean=True)
Shortcut to text:change-start.get_inserted(). Return the content between text:change-start and text:change-end.
If as_text is True: returns the text content. If no_header is True: existing Heading are changed in Paragraph If no_header is True: existing text:h are changed in text:p By default: returns a list of Element, cleaned and with headers
Arguments:
as_text -- boolean
clean -- boolean
no_header -- boolean
Return: list or Element or text
Source code in odfdo/tracked_changes.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
set_change_info(change_info=None, creator=None, date=None, comments=None)
Set the ChangeInfo element for the change element. If change_info is not provided, creator, date and comments will be used to build a suitable change info element. Default for creator is ‘Unknown’, default for date is current time and default for comments is no comment at all. The new change info element will replace any existant ChangeInfo.
Arguments:
change_info -- ChangeInfo element (or None)
cretor -- str (or None)
date -- datetime (or None)
comments -- Paragraph or list of Paragraph elements (or None)
Source code in odfdo/tracked_changes.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
TocEntryTemplate
Bases: Element
ODF “text:table-of-content-entry-template”
Arguments:
style -- str
Source code in odfdo/toc.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
|
TrackedChanges
Bases: MDZap
, Element
The TrackedChanges “text:tracked-changes” element acts as a container for TextChangedRegion elements that represent changes in a certain scope of an OpenDocument document. This scope is the element in which the TrackedChanges element occurs. Changes in this scope shall be tracked by TextChangedRegion elements contained in the TrackedChanges element in this scope. If a TrackedChanges element is absent, there are no tracked changes in the corresponding scope. In this case, all change mark elements in this scope shall be ignored.
Source code in odfdo/tracked_changes.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
|
UserDefined
Bases: ElementTyped
Return a user defined field “text:user-defined”. If the current document is provided, try to extract the content of the meta user defined field of same name.
Arguments:
name -- str, name of the user defined field
value -- python typed value, value of the field
value_type -- str, office:value-type known type
text -- str
style -- str
from_document -- ODF document
Source code in odfdo/variable.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
VarChapter
Bases: Element
Source code in odfdo/variable.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
|
__init__(display='name', outline_level=None, **kwargs)
display can be: ‘number’, ‘name’, ‘number-and-name’, ‘plain-number’ or ‘plain-number-and-name’
Source code in odfdo/variable.py
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
|
VarFileName
Bases: Element
Source code in odfdo/variable.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
|
__init__(display='full', fixed=False, **kwargs)
display can be: ‘full’, ‘path’, ‘name’ or ‘name-and-extension’
Source code in odfdo/variable.py
436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
|
VarPageNumber
Bases: Element
select_page – string in (‘previous’, ‘current’, ‘next’)
page_adjust – int (to add or subtract to the page number)
Source code in odfdo/variable.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
|
XmlPart
Representation of an XML part.
Abstraction of the XML library behind.
Source code in odfdo/xmlpart.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
body
property
writable
Get or set the document body : ‘office:body’
xpath(xpath_query)
Apply XPath query to the XML part. Return list of Element or EText instances translated from the nodes found.
Source code in odfdo/xmlpart.py
101 102 103 104 105 106 |
|
PageBreak()
Return an empty paragraph with a manual page break.
Using this function requires to register the page break style with
document.add_page_break_style()
Source code in odfdo/paragraph.py
1014 1015 1016 1017 1018 1019 1020 |
|
create_table_cell_style(border=None, border_top=None, border_bottom=None, border_left=None, border_right=None, padding=None, padding_top=None, padding_bottom=None, padding_left=None, padding_right=None, background_color=None, shadow=None, color=None)
Return a cell style.
The borders arguments must be some style attribute strings or None, see the method ‘make_table_cell_border_string’ to generate them. If the ‘border’ argument as the value ‘default’, the default style “0.06pt solid #000000” is used for the 4 borders. If any value is used for border, it is used for the 4 borders, else any of the 4 borders can be specified by it’s own string. If all the border, border_top, border_bottom, … arguments are None, an empty border is used (ODF value is fo:border=”none”).
Padding arguments are string specifying a length (e.g. “0.5mm”)”. If ‘padding’ is provided, it is used for the 4 sides, else any of the 4 sides padding can be specified by it’s own string. Default padding is no padding.
Arguments:
border -- str, style string for borders on four sides
border_top -- str, style string for top if no 'border' argument
border_bottom -- str, style string for bottom if no 'border' argument
border_left -- str, style string for left if no 'border' argument
border_right -- str, style string for right if no 'border' argument
padding -- str, style string for padding on four sides
padding_top -- str, style string for top if no 'padding' argument
padding_bottom -- str, style string for bottom if no 'padding' argument
padding_left -- str, style string for left if no 'padding' argument
padding_right -- str, style string for right if no 'padding' argument
background_color -- str or rgb 3-tuple, str is 'black', 'grey', ... or '#012345'
shadow -- str, e.g. "#808080 0.176cm 0.176cm"
color -- str or rgb 3-tuple, str is 'black', 'grey', ... or '#012345'
Return : Style
Source code in odfdo/style.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
|
default_frame_position_style(name='FramePosition', horizontal_pos='from-left', vertical_pos='from-top', horizontal_rel='paragraph', vertical_rel='paragraph')
Helper style for positioning frames in desktop applications that need it.
Default arguments should be enough.
Use the returned Style as the frame style or build a new graphic style with this style as the parent.
Source code in odfdo/frame.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
default_toc_level_style(level)
Generate an automatic default style for the given TOC level.
Source code in odfdo/toc.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
hex2rgb(color)
Turns a “#RRGGBB” hexadecimal color representation into a (R, G, B) tuple.
Arguments:
color -- str
Return: tuple
Source code in odfdo/utils/color.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
hexa_color(color=None)
Convert a color definition of type tuple or string to hexadecimal representation.
Empty string is converted to black. None is converted to None.
Arguments:
color -- str or tuple or None
Return: str or None
Source code in odfdo/utils/color.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
make_table_cell_border_string(thick=None, line=None, color=None)
Returns a string for style:table-cell-properties fo:border, with default : “0.06pt solid #000000”
thick -- str or float or int
line -- str
color -- str or rgb 3-tuple, str is 'black', 'grey', ... or '#012345'
Returns : str
Source code in odfdo/style.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
rgb2hex(color)
Turns a color name or a (R, G, B) color tuple into a “#RRGGBB” hexadecimal representation.
Arguments:
color -- str or tuple
Return: str
Examples::
>>> rgb2hex('yellow')
'#FFFF00'
>>> rgb2hex((238, 130, 238))
'#EE82EE'
Source code in odfdo/utils/color.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
The comments available in the ChangeInfo are available through
Arguments:
creator – str (or None)
date – datetime (or None)