def Sauver(self):
        self.fbb.Disable()
        self.sauver.Disable()
        if self.sauver_ouvrir:
            self.sauver_ouvrir.Disable()
        self.filename = self.fbb.GetValue()
        f, e = os.path.splitext(self.filename)
        if e == ".pdf":
            self.pdf = True
            self.oo_filename = f + self.extension
        else:
            self.pdf = False
            self.oo_filename = self.filename

        config.documents_directory = os.path.dirname(self.filename)
        dlg = None
        try:
            if self.modifications.multi is not False:
                errors = {}
                simple_modifications = self.modifications.get_simple_modifications(self.oo_filename)
                for i, (filename, modifs) in enumerate(simple_modifications):
                    self.gauge.SetValue((100 * i) / len(simple_modifications))
                    errors.update(GenerateDocument(modifs, filename=filename))
                    if self.pdf:
                        f, e = os.path.splitext(filename)
                        convert_to_pdf(filename, f + ".pdf")
                        os.remove(filename)
            else:
                self.filename = self.filename.replace(" <prenom> <nom>", "")
                self.oo_filename = self.oo_filename.replace(" <prenom> <nom>", "")
                errors = GenerateDocument(self.modifications, filename=self.oo_filename, gauge=self.gauge)
                if self.pdf:
                    convert_to_pdf(self.oo_filename, self.filename)
                    os.remove(self.oo_filename)
            self.document_generated = True
            if errors:
                message = "Document %s généré avec des erreurs :\n" % self.filename
                for label in errors.keys():
                    message += '\n' + label + ' :\n  '
                    message += '\n  '.join(errors[label])
                dlg = wx.MessageDialog(self, message, 'Message', wx.OK | wx.ICON_WARNING)
        except IOError:
            print(sys.exc_info())
            dlg = wx.MessageDialog(self, "Impossible de sauver le document. Peut-être est-il déjà ouvert ?", 'Erreur',
                                   wx.OK | wx.ICON_WARNING)
            dlg.ShowModal()
            dlg.Destroy()
            return
        except Exception as e:
            info = sys.exc_info()
            message = ' [type: %s value: %s traceback: %s]' % (info[0], info[1], traceback.extract_tb(info[2]))
            dlg = wx.MessageDialog(self, message, 'Erreur', wx.OK | wx.ICON_WARNING)
        if dlg:
            dlg.ShowModal()
            dlg.Destroy()
        self.EndModal(wx.ID_OK)