Beispiel #1
0
 def test_add_textfield_bad_template(self):
     tc = Thinkcell()
     template = "example.pptx"
     with pytest.raises(ValueError) as e_info:
         tc.add_textfield(
             template_name="example2.pptx",
             field_name="Title",
             text="A great slide",
         )
Beispiel #2
0
 def test_add_textfield_warning(self):
     tc = Thinkcell()
     template_name = "template.pptx"
     tc.add_template(template_name)
     with pytest.warns(UserWarning) as record:
         tc.add_textfield(
             template_name=template_name,
             field_name=234,
             text="A great slide",
         )
Beispiel #3
0
 def test_add_textfield(self):
     tc = Thinkcell()
     template = "example.pptx"
     tc.add_template(template)
     tc.add_textfield(
         template_name=template,
         field_name="Title",
         text="A great slide",
     )
     assert tc.charts == [{
         "template":
         "example.pptx",
         "data": [{
             "name": "Title",
             "table": [
                 [
                     {
                         "string": "A great slide"
                     },
                 ],
             ],
         }],
     }]
Beispiel #4
0
charts = [chart_1, chart_2, chart_3]

template_name = "complex-template-text-field.pptx"
filename = "complex-example-with-multiple-slides.ppttc"
tc = Thinkcell()
tc.add_template(template_name)

for chart in charts:
    tc.add_chart_from_dataframe(
        template_name=template_name,
        chart_name=chart["chart_name"],
        dataframe=chart["dataframe"],
    )
tc.add_textfield(template_name=template_name,
                 field_name="chart_text",
                 text="First instance")

charts = [chart_1, chart_2, chart_4]
tc.add_template(template_name)

for chart in charts:
    tc.add_chart_from_dataframe(
        template_name=template_name,
        chart_name=chart["chart_name"],
        dataframe=chart["dataframe"],
    )
tc.add_textfield(
    template_name=template_name,
    field_name="chart_text",
    text="Second instance",