ODPSlides Code Functions

class odpslides.presentation.Presentation(title_font_color='black', subtitle_font_color='#666666', background_image='', background_color='white', grad_start_color='', grad_end_color='', grad_angle_deg=0, grad_draw_style='linear', show_date=False, date_font_color='#666666', footer='', footer_font_color='#666666', show_page_numbers=True, page_number_font_color='#666666')

Creates OpenDocument Presentations for Microsoft PowerPoint, LibreOffice and OpenOffice. Output is a *.odp file.

Parameters:
  • title_font_color (str) – (default==’black’)

  • subtitle_font_color (str) – (default==’#666666’)

  • background_image (str) – (default==””)

  • background_color (str) – (default==”white”)

  • grad_start_color (str) – Color Gradient start color. If blank then not used (default==””)

  • grad_end_color (str) – Color Gradient end color. If blank then not used (default==””)

  • grad_angle_deg (int) – Color Gradient angle, in degrees (default==0)

  • grad_draw_style (str) – Color Gradient style, “linear”, “radial”, (default==’linear’)

  • show_date (bool) – (default==False)

  • date_font_color (str) – (default==’#666666’)

  • footer (str) – String displayed as footer on each slide (default==””)

  • footer_font_color (str) – (default==’#666666’)

  • show_page_numbers (bool) – (default==True)

  • page_number_font_color (str) – (default==”#666666”)

add_office_styles(style_elem)

Put draw:gradient and draw:image-fill into styles.xml

add_text_box_to_last_slide(text_or_list='', text_font_colors='', x=8.0, y=2.0)

Add a text box to the last added slide in the presentation

add_title_chart(title='My Title', subtitle='My Subtitle', title_font_color='', subtitle_font_color='', background_color='', pcent_stretch_center=0, pcent_stretch_content=0, pcent_move_content_right=None, pcent_move_content_up=None)

Create a title slide with subtitle.

Parameters:
  • title (str) – (default==’My Title’)

  • subtitle (str) – (default==’My Subtitle’)

  • title_font_color (str) – (default==’’)

  • subtitle_font_color (str) – (default==’’)

  • background_color (str) – (default==””)

Returns:

None

Return type:

None

add_titled_image(title='My Picture', title_font_color='', image_file='', image_2_file='', image_3_file='', image_4_file='', keep_aspect_ratio=True, big_3rd_img_left=True, pcent_stretch_center=0, pcent_stretch_content=0, pcent_move_content_right=None, pcent_move_content_up=None)

Create a slide with a title and 1 to 4 images.

Parameters:
  • title (str) – (default==’My Picture’)

  • title_font_color (str) – (default==’’)

  • image_file (str) – Full path to image #1 file on system (png, gif or jpg) (default==’’)

  • image_2_file (str) – Full path to image #2 file on system (png, gif or jpg) (default==’’)

  • image_3_file (str) – Full path to image #3 file on system (png, gif or jpg) (default==’’)

  • image_4_file (str) – Full path to image #4 file on system (png, gif or jpg) (default==’’)

  • keep_aspect_ratio (bool) – If true then adjust slide to maintain original aspect ratio (default==True)

  • big_3rd_img_left (bool) – For three images, if True, put big image on the left (default==True)

  • pcent_stretch_center (int) – Percentage by which to enlarge the central, content area (default==0)

  • pcent_stretch_content (int) – Percentage by which to enlarge image(s) (default==0)

  • pcent_move_content_right (None) – Move content items left/right. (list of values from -100 to 100) (default==None)

  • pcent_move_content_up (None) – Move content items up/down. (list of values from -100 to 100) (default==None)

Returns:

None

Return type:

None

add_titled_outline_chart(title='My Title', title_font_color='', outline='', text_font_color='', pcent_stretch_center=0, pcent_stretch_content=0, pcent_move_content_right=None, pcent_move_content_up=None)

Create a slide with a title and a text outline below.

An outline string is a single string with embedded carriage returns and tab characters. It can also follow a python-like format of four spaces being equal to a tab character.

Tab characters(or 4 spaces) indicate indenting, carriage returns indicate a new line.

Parameters:
  • title (str) – (default==’My Title’)

  • title_font_color (str) – (default==’’)

  • outline (str) – The text of the outline in indented format (see above) (default==’’)

  • text_font_color (str) – (default==’’)

  • pcent_stretch_center (int) – (default==0)

  • pcent_stretch_content (int) – (default==0)

  • pcent_move_content_right (None) – Move content items left/right. (list of values from -100 to 100) (default==None)

  • pcent_move_content_up (None) – Move content items up/down. (list of values from -100 to 100) (default==None)

Returns:

None

Return type:

None

add_titled_text_and_image(text_location='top', title='My Picture', title_font_color='', outline='', text_font_color='', image_file='', keep_aspect_ratio=True, image_2_file='', pcent_stretch_center=0, pcent_stretch_content=0, pcent_move_content_right=None, pcent_move_content_up=None)

Create a slide with a text outline and 1 or 2 image(s).

An outline string is a single string with embedded carriage returns and tab characters. It can also follow a python-like format of four spaces being equal to a tab character.

Tab characters(or 4 spaces) indicate indenting, carriage returns indicate a new line.

Parameters:
  • text_location (str) – Text location (“top”, “bottom”, “right”, “left”) (default==’top’)

  • title (str) – (default==’My Picture’)

  • title_font_color (str) – (default==’’)

  • outline (str) – The text of the outline in indented format (see above) (default==’’)

  • text_font_color (str) – (default==’’)

  • image_file (str) – Full path to image #1 file on system (png, gif or jpg) (default==’’)

  • image_2_file (str) – Full path to image #2 file on system (png, gif or jpg) (default==’’)

  • keep_aspect_ratio (bool) – If true then adjust slide to maintain original aspect ratio (default==True)

  • pcent_stretch_center (int) – Percentage by which to enlarge the central, content area (default==0)

  • pcent_stretch_content (int) – Percentage by which to enlarge image(s) (default==0)

  • pcent_move_content_right (None) – Move content items left/right. (list of values from -100 to 100) (default==None)

  • pcent_move_content_up (None) – Move content items up/down. (list of values from -100 to 100) (default==None)

Returns:

None

Return type:

None

add_titled_two_outline_chart(title='My Title', title_font_color='', outline='', text_font_color='', outline_2='', text_2_font_color='', pcent_stretch_center=0, pcent_stretch_content=0, pcent_move_content_right=None, pcent_move_content_up=None)

Create a slide with a title and two side-by-side text outlines.

An outline string is a single string with embedded carriage returns and tab characters. It can also follow a python-like format of four spaces being equal to a tab character.

Tab characters(or 4 spaces) indicate indenting, carriage returns indicate a new line.

Parameters:
  • title (str) – (default==’My Title’)

  • title_font_color (str) – (default==’’)

  • outline (str) – The text of the outline in indented format (see above) (default==’’)

  • text_font_color (str) – (default==’’)

  • outline_2 (str) – The text of outline #2 in indented format (see above) (default==’’)

  • text_2_font_color (str) – (default==’’)

  • pcent_stretch_center (int) – (default==0)

  • pcent_stretch_content (int) – (default==0)

  • pcent_move_content_right (None) – Move content items left/right. (list of values from -100 to 100) (default==None)

  • pcent_move_content_up (None) – Move content items up/down. (list of values from -100 to 100) (default==None)

Returns:

None

Return type:

None

get_next_a_style()

Returns a string like “a123”

get_next_draw_id()

Returns a string like “id123”

get_next_image_name(file_sys_name)

Returns a string like “image1”, “image2”, …

launch_application()

Will launch PowerPoint, LibreOffice or Openoffice using “os.startfile” or “open” or “xdg-open” depending on the platform.

ONLY WORKS IF file has been saved.

save(filename='my_presentation.odp', launch=False)

Saves Presentation to an odp file readable by Microsoft PowerPoint, LibreOffice or OpenOffice.

If the launch flag is set, will launch PowerPoint, LibreOffice or Openoffice using “os.startfile” or “open” or “xdg-open” depending on the platform.

Parameters:
  • filename (str or unicode) – Name of ods file to save (default==’my_presentation.odp’)

  • launch (bool) – If True, will launch PowerPoint, LibreOffice or OpenOffice (default==False)

Returns:

None

Return type:

None

set_bullets(top_elem)

I can’t seem to find where my unicode bullet chars are getting messed up. For now, set all bullets to the bullet character.