Open Sefran007 opened 2 years ago
Sorry for using google translate. You have two options for using the library without changing it:
from odf.attrconverters import make_NCName
from odf.style import Style
from odf.table import Table
display_name = "New Style" name = make_NCName(display_name) Style(name=display_name) ...
t = Table(stylename=name)
from odf.opendocument import OpenDocumentText from odf.style import Style, TextProperties, ParagraphProperties
document_test = OpenDocumentText()
paragraph_style = Style(name='Test', family='paragraph') paragraph_style.addElement(ParagraphProperties(numberlines='false', linenumber='0')) paragraph_style.addElement(TextProperties(fontsize='24pt', fontweight='bold')) document_test.automaticstyles.addElement(paragraph_style)
document_test.contentxml()
Return : b'\<?xml …>\ \\ \</office:body>\</office:document-content>'
Missing xml syntax of automatic style
I'm test them on Ubuntu 21.04 and Manjaro 21.2.1 with Python 3.9.5 and 3.10.1