Skip to content

Python module to create simple rtf files.

License

Notifications You must be signed in to change notification settings

xavi-mat/simplertf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simplertf

Simple RTF creator.

Python module to create simple rtf documents. Main 'RTF' class defines objects where add paragraphs, footnotes, and text with different formatting options. Properties of paper size and margins are also supported. By Xavimat.

TODO

(I'm currently trying a simplefodt creator because rtf was too limited. Leaving this here in case anyone finds it useful.)

  • Font Table, Color Table, Stylesheet.
    • Customizable outside the Rtf class, and added later to it.
    • Default font tables, color tables and stylesheets.
  • Info about languages and language codes.
    • Table of info about languages.
    • For example, Style.lang = "Italian" will set automatically to 1040.
  • Customizable Footnote options.

(All this is currently possible, but only inside the RTF class, and you'll need to know the codes and variable names.)

Simple example

import simplertf
r = simplertf.RTF("My Document Title")
r.author = "Myself"
r.set_layout("A4")
r.par("This text starts a paragraph.")
r.text(" This text continues the paragraph, note the space before 'This'.")
r.note("The text of a footnote.", anchor="*")
r.par("A new paragraph begins. Former note and paragraph are automatically closed.")
r.note("This is the text of the second footnote.")
r.text(" I'm adding text to the second footnote.")
r.close_note()
r.text(" Now I'm adding text to the second paragraph. I had to close the note manually.")
r.create("File name")

About

Python module to create simple rtf files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages