def test_odf_create_chart_title_style(self): s=odf_create_chart_title_style("title", "12pt") expected=('<style:style style:family="chart" style:name="title">' '<style:chart-properties chart:auto-position="true"/>' '<style:text-properties fo:font-size="12pt" ' 'style:font-size-asian="12pt" ' 'style:font-size-complex="12pt"/>' '</style:style>') self.assertEqual(s.serialize(), expected)
chart_directory = add_chart_structure_in_document(doc) #we need an access to the office:automatic-styles element from lpod.xmlpart import odf_xmlpart chart_content = odf_xmlpart(chart_directory+'/content.xml', doc) styles = chart_content.get_element("office:automatic-styles") #we add informations about style from chart_style import odf_create_chart_title_style from chart_style import odf_create_chart_legend_style from chart_style import odf_create_chart_plot_area_style from chart_style import odf_create_chart_axis_style from chart_style import odf_create_chart_axis_title_style from chart_style import odf_create_chart_wall_style, odf_create_chart_style styles.append(odf_create_chart_title_style("titre", "12pt")) plot_s=odf_create_chart_plot_area_style("plot") styles.append(plot_s) styles.append(odf_create_chart_axis_style("axe x")) styles.append(odf_create_chart_axis_style("axe y")) styles.append(odf_create_chart_wall_style("wall")) #we choose a color for each series palette=['#0000ff', '#bf00ff', '#ff0080', '#ff4000', '#ffff00', '#40ff00', '#00ff7f', '#00bfff', '#6000ff', '#ff00df', '#ff0020', '#ff9f00', '#9fff00', '#00ff20', '#00ffdf', '#0060ff'] from chart import divide_range cols_list = divide_range("Data.A1:Data.E5") for i in range(len(cols_list)): s = odf_create_chart_style("series"+str(i))
chart_directory = add_chart_structure_in_document(doc) #we need an access to the office:automatic-styles element from lpod.xmlpart import odf_xmlpart chart_content = odf_xmlpart(chart_directory + '/content.xml', doc) styles = chart_content.get_element("office:automatic-styles") #we add informations about style from chart_style import odf_create_chart_title_style from chart_style import odf_create_chart_legend_style from chart_style import odf_create_chart_plot_area_style from chart_style import odf_create_chart_axis_style from chart_style import odf_create_chart_axis_title_style from chart_style import odf_create_chart_wall_style, odf_create_chart_style styles.append(odf_create_chart_title_style("titre", "12pt")) plot_s = odf_create_chart_plot_area_style("plot") styles.append(plot_s) styles.append(odf_create_chart_axis_style("axe x")) styles.append(odf_create_chart_axis_style("axe y")) styles.append(odf_create_chart_wall_style("wall")) #we choose a color for each series palette = [ '#0000ff', '#bf00ff', '#ff0080', '#ff4000', '#ffff00', '#40ff00', '#00ff7f', '#00bfff', '#6000ff', '#ff00df', '#ff0020', '#ff9f00', '#9fff00', '#00ff20', '#00ffdf', '#0060ff' ] from chart import divide_range cols_list = divide_range("Data.A1:Data.E5")