Ejemplo n.º 1
0
 def addList(self,elements):
     textList = List(stylename="L1")
     for element in elements:
      item = ListItem()
      item.addElement(P(text=element))
      textList.addElement(item)
     self.textdoc.text.addElement(textList)
Ejemplo n.º 2
0
def createList(itemList, indentDelim, styleName):
    listArray = []
    listItem = ListItem()
    level = 0
    lastLevel = 0

    for levCount in range(0,10):
        listArray.append(None)
    listArray[0] = List()

    for item in itemList:
        level = 0;
        while (level < len(item) and item[level] == indentDelim):
            level +=1
        item = item[level:]

        if (level > lastLevel):    # open the sub-levels
            for levCount in range(lastLevel+1, level+1):
                listArray[levCount] = List()
        elif (level < lastLevel):    # close off the intervening lists
            for levCount in range(lastLevel, level, -1):
                listArray[levCount-1].childNodes[-1].addElement(listArray[levCount])

        # now that we are at the proper level, add the item.
        listArray[level].setAttribute( 'stylename', styleName );
        listItem = ListItem()
        para = P(text=item);
        listItem.addElement(para);
        listArray[level].addElement(listItem);
        lastLevel = level;

    # close off any remaining open lists
    for levCount in range(lastLevel, 0, -1):
        listArray[levCount-1].childNodes[-1].addElement(listArray[levCount])
    return listArray[0]
Ejemplo n.º 3
0
 def addList(self, content, stylename):        
     liste = List()
     for e in content:
         p = P(stylename=stylename, text=e)
         i = ListItem()
         i.addElement(p)
         liste.addElement(i)
     self.document.text.addElement(liste)
Ejemplo n.º 4
0
	def build_document_list(self, list_items):
		l = List() 
		for item in list_items:
			p = P(text=item)
			i = ListItem()
			i.addElement(p)
			l.addElement(i)

		return l
Ejemplo n.º 5
0
 def make_eleve_id(self, dict):
     mdp = dict["mot de passe"]
     L = dict["nom"]+" "+dict["prenom"]+" :\t\t "+dict["login"]+" -- "+\
         (mdp if len(mdp)<=8 else "mdp déjà utilisé")
     stylename = getattr(self, "normal", None)
     p = P(stylename=stylename, text=L)
     i = ListItem()
     i.addElement(p)
     return i
Ejemplo n.º 6
0
	def build_list(self, list_items):
		l = List() 
		for item in self.get_dependency_to_items(list_items):
			p = P(text=item)
			i = ListItem()
			i.addElement(p)
			l.addElement(i)

		return l
Ejemplo n.º 7
0
def do_values(doc, values):
    if values is None:
        return None

    lst = List()

    for v in values.findall('value'):
        p = P(stylename='TextBold')
        bold(p, v.attrib['name'] + ': ')
        p.addText(v.find('doc').text)
        item = ListItem()
        item.addElement(p)
        lst.addElement(item)

    return lst
Ejemplo n.º 8
0
def do_values(doc, values):
    if values is None:
        return None

    lst = List()

    for v in values.findall('value'):
        p = P(stylename='TextBold')
        bold(p, v.attrib['name'] + ': ')
        p.addText(v.find('doc').text)
        item = ListItem()
        item.addElement(p)
        lst.addElement(item)

    return lst
Ejemplo n.º 9
0
 def createList(self, itemList, indentDelim, styleName):
     listArray = []
     listItem = ListItem()
     level = 0
     lastLevel = 0
             
     for levCount in range(0,10):
         listArray.append(None)
     listArray[0] = List()
     
     for item in itemList:
         level = 0;
         while (level < len(item) and item[level] == indentDelim):
             level +=1
         item = item[level:]
         
         if (level > lastLevel):    # open the sub-levels
             for levCount in range(lastLevel+1, level+1):
                 listArray[levCount] = List()
         elif (level < lastLevel):    # close off the intervening lists
             for levCount in range(lastLevel, level, -1):
                 listArray[levCount-1].childNodes[-1].addElement(listArray[levCount])
                 
         # now that we are at the proper level, add the item.
         listArray[level].setAttribute( 'stylename', styleName );
         listItem = ListItem()
         para = P(text=item);
         listItem.addElement(para);
         listArray[level].addElement(listItem);
         lastLevel = level;
         
     # close off any remaining open lists
     for levCount in range(lastLevel, 0, -1):
         listArray[levCount-1].childNodes[-1].addElement(listArray[levCount])
     return listArray[0]
Ejemplo n.º 10
0
    def create_list(item_list, indent_delim, style_name):
        """
        TODO.
        :param item_list: array of list items,
        :param indent_delim: char identifying the nesting depth of list items,
        :param style_name: easyliststyle identifier.
        """
        list_array = []
        last_level = 0

        for _ in range(0, 10):
            list_array.append(None)
        list_array[0] = List()

        for item in item_list:
            level = 0
            while level < len(item) and item[level] == indent_delim:
                level += 1
            item = item[level:]

            if level > last_level:
                for lev_count in range(last_level + 1, level + 1):
                    list_array[lev_count] = List()
            elif level < last_level:
                for lev_count in range(last_level, level, -1):
                    list_array[lev_count - 1].childNodes[-1].addElement(
                        list_array[lev_count])

            list_array[level].setAttribute("stylename", style_name)
            list_item = ListItem()
            para = P(text=item)
            list_item.addElement(para)
            list_array[level].addElement(list_item)
            last_level = level

        for lev_count in range(last_level, 0, -1):
            list_array[lev_count - 1].childNodes[-1].addElement(
                list_array[lev_count])
        return list_array[0]
Ejemplo n.º 11
0
def groupPage(group, lang):
    grouptitle = H(stylename=h3style, text=group, outlinelevel=3)
    textdoc.text.addElement(grouptitle)
    blankline = P(text="")
    textdoc.text.addElement(blankline)

    if td != '':
        table = Table()
        table.addElement(TableColumn(numbercolumnsrepeated=2))
        headers = [
            translation['part'][lang], '2 ' + translation['period'][lang]
        ]  #,"2. Ebaluazioa","Azken Ebaluazioa"]
        tr = TableRow()
        table.addElement(tr)
        for val in headers:
            tc = TableCell(stylename="Table")
            tr.addElement(tc)
            p = P(stylename=tableheaders, text=val)
            tc.addElement(p)
        #f = [["garbitasuna",3,6],["materiala",6,8],["Adostasuna", "Ez konforme","konforme"],["Harremanak1",7,8],["Harremanak2",6,7],["Adostasuna", "konforme","konforme"]]
        g = group.replace(". ", "")
        g = g.replace("º ", "")
        g = g.replace(".", "")
        g = g.replace("º", "")
        g = g.replace("° ", "")
        g = g.replace("°", "")
        g = g.replace(" ", "")
        g = g.replace("Bach1", "5")
        g = g.replace("Bach2", "6")
        g = g.replace("Batx1", "5")
        g = g.replace("Batx2", "6")
        f = td[g]
        for line in f:
            if "group" in line:  #FIXME: If not all group tables contain a row with the group name (also in text header...)
                continue
            tr = TableRow()
            table.addElement(tr)
            for i, val in enumerate(line):
                if i == 0:
                    tc = TableCell(stylename="Table")
                    tr.addElement(tc)
                    p = P(stylename=tablecontents, text=translation[val][lang])
                elif val == "EzKonforme":
                    tc = TableCell(stylename="Table")
                    tr.addElement(tc)
                    p = P(stylename=tablecontentscenterred,
                          text=translation[val][lang])
                elif val == "Konforme":
                    tc = TableCell(stylename="Table")
                    tr.addElement(tc)
                    p = P(stylename=tablecontentscenter,
                          text=translation[val][lang])
                else:
                    tc = TableCell(stylename="Table")
                    tr.addElement(tc)
                    if isinstance(val, numbers.Number):
                        val = round(val, 1)
                    p = P(stylename=tablecontentscenter, text=val)
                tc.addElement(p)

        textdoc.text.addElement(table)

        blankline = P(text="")
        textdoc.text.addElement(blankline)
    if lang == "eu":
        subjectsp = P(text="%70 baino gainditu gutxiago duten ikasgaiak:")
    else:
        subjectsp = P(text="Asignaturas con menos del %70 de aprobados:")
    textdoc.text.addElement(subjectsp)
    blankline = P(text="")
    textdoc.text.addElement(blankline)
    textList = List(stylename="L1")

    file = path + "ehunekoak-" + period + "-" + year + "-" + group + ".csv"
    with open(file, 'r', encoding="UTF-8") as results:
        reader = csv.reader(results)
        headers = next(reader, None)  # get first row with headers
        for row in reader:
            if float(row[1]) < 70 and row[0] != "All":
                item = ListItem()
                if lang == "eu":
                    item.addElement(
                        P(text=row[0] + ": " + "{:.2f}".format(float(row[1])) +
                          "%"))
                else:
                    item.addElement(
                        P(text=ikasgai[row[0]] + ": " +
                          "{:.2f}".format(float(row[1])) + "%"))
                textList.addElement(item)
                textdoc.text.addElement(textList)

    breakpage = P(stylename=withbreak, text="")
    textdoc.text.addElement(breakpage)

    for diagramtype in [pie, percent]:  #,name2]:
        p = P()
        textdoc.text.addElement(p)
        img_path = path + group + diagramtype
        href = textdoc.addPicture(img_path)
        f = Frame(name=group + diagramtype,
                  anchortype="paragraph",
                  width="17cm",
                  height="7.5cm",
                  zindex="0")
        p.addElement(f)
        img = Image(href=href, type="simple", show="embed", actuate="onLoad")
        f.addElement(img)
Ejemplo n.º 12
0
 def write(self, model):
     self.doc.text.addElement(P(text=model.name, stylename="ResumeH1"))
     self.doc.text.addElement(P(text=model.address, stylename="ResumeH1"))
     self.doc.text.addElement(P(text=", ".join([model.phone, model.email]),
                                stylename="ResumeH1"))
     for contact in model.contacts:
         self.doc.text.addElement(P(text=contact, stylename="ResumeH1"))
     self.nl()
     self.doc.text.addElement(P(text=model.objective_title,
                                stylename="ResumeH1"))
     self.nl()
     for objective in model.objectives:
         self.doc.text.addElement(P(text=objective, stylename="ResumeText"))
     self.nl()
     self.doc.text.addElement(P(text=model.skillarea_title,
                                stylename="ResumeH1"))
     self.nl()
     for i in range(0, len(model.skillset_titles)):
         skillset_line = P(text="")
         skillset_line.addElement(Span(text=model.skillset_titles[i],
                                       stylename="ResumeBoldText"))
         skillset_line.addElement(Span(
             text=": ", stylename="ResumeBoldText"))
         skillset_line.addText(", ".join(model.skillsets[i]))
         self.doc.text.addElement(skillset_line)
     self.nl()
     self.doc.text.addElement(P(
         text=model.jobs_title, stylename="ResumeH1"))
     for i in range(0, len(model.job_titles)):
         self.nl()
         self.doc.text.addElement(P(text=model.job_titles[i],
                                    stylename="ResumeH2"))
         self.doc.text.addElement(P(text=model.job_employers[i],
                                    stylename="ResumeH2"))
         self.doc.text.addElement(P(text=model.job_descriptions[i],
                                    stylename="ResumeText"))
         achievements_list = List(stylename="ResumeTextList")
         for achievement in model.job_achievements[i]:
             achievements_listitem = ListItem()
             achievements_listitem.addElement(P(text=achievement,
                                                stylename="ResumeText"))
             achievements_list.addElement(achievements_listitem)
         self.doc.text.addElement(achievements_list)
     self.nl()
     self.doc.text.addElement(P(text=model.academics_title,
                                stylename="ResumeH1"))
     academics_list = List(stylename="ResumeTextList")
     for academic in model.academics:
         academics_listitem = ListItem()
         academics_listitem.addElement(P(
             text=academic, stylename="ResumeText"))
         academics_list.addElement(academics_listitem)
     self.doc.text.addElement(academics_list)
     self.nl()
     self.doc.text.addElement(P(
         text=model.awards_title, stylename="ResumeH1"))
     awards_list = List(stylename="ResumeTextList")
     for award in model.awards:
         awards_listitem = ListItem()
         awards_listitem.addElement(P(text=award, stylename="ResumeText"))
         awards_list.addElement(awards_listitem)
     self.doc.text.addElement(awards_list)
     self.nl()
Ejemplo n.º 13
0
def do_args(doc, args):
    if args is None:
        return

    table = Table(name="Table 1")
    table.addElement(
        TableColumn(numbercolumnsrepeated='3', stylename='TableAutoWidth'))

    tr = TableRow(stylename='TableAutoWidth')
    table.addElement(tr)

    tc = TableCell(valuetype="string", stylename='Table Heading')
    tc.addElement(P(text='Name'))
    tr.addElement(tc)

    tc = TableCell(valuetype="string", stylename='Table Heading')
    tc.addElement(P(text='Type'))
    tr.addElement(tc)

    tc = TableCell(valuetype="string", stylename='Table Heading')
    tc.addElement(P(text='Description'))
    tr.addElement(tc)

    for t in args.findall('arg'):
        tr = TableRow(stylename='TableAutoWidth')
        table.addElement(tr)

        # Name.
        tc = TableCell(valuetype="string", stylename='Table Contents')
        tc.addElement(P(text=t.attrib['name']))
        tr.addElement(tc)

        # Type.
        tc = TableCell(valuetype="string", stylename='Table Contents')
        tname = t.attrib['type'].strip()
        if tname == 'List':
            refs = []

            for subtype in t.findall('types/type'):
                stname = subtype.attrib['name']
                ref = BookmarkRef(referenceformat='text', refname=stname)
                ref.addText(stname)
                refs.append(ref)

            if len(refs) == 1:
                c = P(text='List of ')
                c.addElement(refs[0])
                tc.addElement(c)
            else:
                c = P(text='List of: ')
                tc.addElement(c)

                lst = List()
                for r in refs:
                    item_p = P()
                    item_p.addElement(r)
                    item = ListItem()
                    item.addElement(item_p)
                    lst.addElement(item)
                tc.addElement(lst)

        else:
            ref = BookmarkRef(referenceformat='text', refname=tname)
            ref.addText(tname)
            c = P()
            c.addElement(ref)
            tc.addElement(c)

        tr.addElement(tc)

        # Description.
        tc = TableCell(valuetype="string", stylename='Table Contents')
        tr.addElement(tc)
        desc = t.find('doc').text
        if 'value' in t.attrib:
            desc += 'This argument has a fixed value of %s.' % t.attrib['value']
        tc.addElement(P(text=desc))

        lst = do_values(doc, t.find('values'))
        if lst is not None:
            tc.addElement(lst)

    doc.text.addElement(table)
Ejemplo n.º 14
0
def do_args(doc, args):
    if args is None:
        return

    table = Table(name = "Table 1")
    table.addElement(TableColumn(numbercolumnsrepeated = '3', stylename = 'TableAutoWidth'))

    tr = TableRow(stylename = 'TableAutoWidth')
    table.addElement(tr)

    tc = TableCell(valuetype = "string", stylename = 'Table Heading')
    tc.addElement(P(text = 'Name'))
    tr.addElement(tc)

    tc = TableCell(valuetype = "string", stylename = 'Table Heading')
    tc.addElement(P(text = 'Type'))
    tr.addElement(tc)

    tc = TableCell(valuetype = "string", stylename = 'Table Heading')
    tc.addElement(P(text = 'Description'))
    tr.addElement(tc)

    for t in args.findall('arg'):
        tr = TableRow(stylename = 'TableAutoWidth')
        table.addElement(tr)

        # Name.
        tc = TableCell(valuetype = "string", stylename = 'Table Contents')
        tc.addElement(P(text = t.attrib['name']))
        tr.addElement(tc)

        # Type.
        tc = TableCell(valuetype = "string", stylename = 'Table Contents')
        tname = t.attrib['type'].strip()
        if tname == 'List':
            refs = []

            for subtype in t.findall('types/type'):
                stname = subtype.attrib['name']
                ref = BookmarkRef(referenceformat = 'text', refname = stname)
                ref.addText(stname)
                refs.append(ref)

            if len(refs) == 1:
                c = P(text = 'List of ')
                c.addElement(refs[0])
                tc.addElement(c)
            else:
                c = P(text = 'List of: ')
                tc.addElement(c)

                lst = List()
                for r in refs:
                    item_p = P()
                    item_p.addElement(r)
                    item = ListItem()
                    item.addElement(item_p)
                    lst.addElement(item)
                tc.addElement(lst)

        else:
            ref = BookmarkRef(referenceformat = 'text', refname = tname)
            ref.addText(tname)
            c = P()
            c.addElement(ref)
            tc.addElement(c)

        tr.addElement(tc)

        # Description.
        tc = TableCell(valuetype = "string", stylename = 'Table Contents')
        tr.addElement(tc)
        desc = t.find('doc').text
        if 'value' in t.attrib:
            desc += 'This argument has a fixed value of %s.' % t.attrib['value']
        tc.addElement(P(text = desc))

        lst = do_values(doc, t.find('values'))
        if lst is not None:
            tc.addElement(lst)

    doc.text.addElement(table)
Ejemplo n.º 15
0
def coursePage(coursename, data, lang):
    coursetitle = H(stylename=h2style, text=coursename, outlinelevel=2)
    textdoc.text.addElement(coursetitle)
    blankline = P(text="")
    textdoc.text.addElement(blankline)

    for diagramtype in [pie, percent]:
        p = P()
        textdoc.text.addElement(p)
        img_path = path + coursename + "-All" + diagramtype
        href = textdoc.addPicture(img_path)
        f = Frame(name=coursename + diagramtype,
                  anchortype="paragraph",
                  width="17cm",
                  height="7.5cm",
                  zindex="0")
        p.addElement(f)
        img = Image(href=href, type="simple", show="embed", actuate="onLoad")
        f.addElement(img)

    if lang == "eu":
        subjectsp = P(text="%70 baino gainditu gutxiago duten ikasgaiak:")
    else:
        subjectsp = P(text="Asignaturas con menos del %70 de aprobados:")
    textdoc.text.addElement(subjectsp)
    blankline = P(text="")
    textdoc.text.addElement(blankline)
    textList = List(stylename="L1")

    file = path + "ehunekoak-" + period + "-" + year + "-" + coursename + "None.csv"
    with open(file, 'r', encoding="UTF-8") as results:
        reader = csv.reader(results)
        headers = next(reader, None)  # get first row with headers
        for row in reader:
            if float(row[1]) < 70 and row[0] != "All":
                item = ListItem()
                if lang == "eu":
                    item.addElement(
                        P(text=row[0] + ": " + "{:.2f}".format(float(row[1])) +
                          "%"))
                else:
                    item.addElement(
                        P(text=ikasgai[row[0]] + ": " +
                          "{:.2f}".format(float(row[1])) + "%"))
                textList.addElement(item)
                textdoc.text.addElement(textList)

    for courselang in data.keys():
        coursetitle = H(stylename=h2style,
                        text=coursename + "-" + courselang,
                        outlinelevel=2)
        textdoc.text.addElement(coursetitle)
        blankline = P(text="")
        textdoc.text.addElement(blankline)

        for diagramtype in [pie, percent]:
            p = P()
            textdoc.text.addElement(p)
            img_path = path + coursename + "-" + courselang + diagramtype
            href = textdoc.addPicture(img_path)
            f = Frame(name=coursename + diagramtype + courselang,
                      anchortype="paragraph",
                      width="17cm",
                      height="7.5cm",
                      zindex="0")
            p.addElement(f)
            img = Image(href=href,
                        type="simple",
                        show="embed",
                        actuate="onLoad")
            f.addElement(img)

        blankline = P(text="")
        textdoc.text.addElement(blankline)

        if lang == "eu":
            subjectsp = P(text="%70 baino gainditu gutxiago duten ikasgaiak:")
        else:
            subjectsp = P(text="Asignaturas con menos del %70 de aprobados:")
        textdoc.text.addElement(subjectsp)
        blankline = P(text="")
        textdoc.text.addElement(blankline)
        textList = List(stylename="L1")

        file = path + "ehunekoak-" + period + "-" + year + "-" + coursename + courselang + ".csv"
        with open(file, 'r', encoding="UTF-8") as results:
            reader = csv.reader(results)
            headers = next(reader, None)  # get first row with headers
            for row in reader:
                if float(row[1]) < 70 and row[0] != "All":
                    item = ListItem()
                    if lang == "eu":
                        item.addElement(
                            P(text=row[0] + ": " +
                              "{:.2f}".format(float(row[1])) + "%"))
                    else:
                        item.addElement(
                            P(text=ikasgai[row[0]] + ": " +
                              "{:.2f}".format(float(row[1])) + "%"))
                    textList.addElement(item)
                    textdoc.text.addElement(textList)

        for group in data[courselang]:
            if group in ["Bil", "Plur"]:
                #1 ESO-AG-AGBil - 2. Ebaluazioa (2019-2020) -percent-es
                g = coursename + "-" + courselang + "-" + courselang + group
                grouptitle = H(stylename=h3style,
                               text=translation[group][lang],
                               outlinelevel=3)
                textdoc.text.addElement(grouptitle)
                blankline = P(text="")
                textdoc.text.addElement(blankline)
                for diagramtype in [mean, percent]:  #,name2]:
                    p = P()
                    textdoc.text.addElement(p)
                    img_path = path + g + diagramtype
                    href = textdoc.addPicture(img_path)
                    f = Frame(name=group + diagramtype,
                              anchortype="paragraph",
                              width="17cm",
                              height="7.5cm",
                              zindex="0")
                    p.addElement(f)
                    img = Image(href=href,
                                type="simple",
                                show="embed",
                                actuate="onLoad")
                    f.addElement(img)
            else:
                groupPage(group, lang)
Ejemplo n.º 16
0
h=H(outlinelevel=1, text='Purpose (Heading 1)')
textdoc.text.addElement(h)
p = P(text="The following sections illustrate various possibilities in ODF Text",stylename='Text_20_body')
textdoc.text.addElement(p)

textdoc.text.addElement(H(outlinelevel=2,text='A simple series of paragraphs (Heading 2)'))
textdoc.text.addElement(P(text="This section contains a series of paragraphs.", stylename='Text_20_body'))
textdoc.text.addElement(P(text="This is a second paragraph.",stylename='Text_20_body'))
textdoc.text.addElement(P(text="And a third paragraph.", stylename='Text_20_body'))

textdoc.text.addElement(H(outlinelevel=2,text='A section with lists (Heading 2)'))
textdoc.text.addElement(P(text="Elements to illustrate:"))

# add the first list (unordered list)
textList = List(stylename="L1")
item = ListItem()
item.addElement(P(text='hyperlinks', stylename="P1"))
textList.addElement(item)

item = ListItem()
item.addElement(P(text='italics and bo  ld text', stylename="P1"))
textList.addElement(item)

item = ListItem()
item.addElement(P(text='lists (ordered and unordered)', stylename="P1"))
textList.addElement(item)

textdoc.text.addElement(textList)

# add the second (ordered) list
Ejemplo n.º 17
0
textdoc = OpenDocumentText()

symbolstyle = Style(name="Numbering Symbols", family="text")
textdoc.styles.addElement(symbolstyle)

liststyle = Style(name="List Content", family="paragraph")
liststyle.addElement(ParagraphProperties(numberlines="false", linenumber="0"))
textdoc.automaticstyles.addElement(liststyle)

listhier = ListStyle(name="MyList")
level = 1
for bullet in [u"–", u"•", u"–",u"•", u"✗", u"✗", u"✗", u"✗", u"✗", u"✗"]:
    b = ListLevelStyleBullet(level=str(level), stylename=symbolstyle, bulletchar=bullet)
    listhier.addElement(b)
    b.addElement(ListLevelProperties(minlabelwidth="%dcm" % level))
    b.addElement(TextProperties(fontname="StarSymbol"))
    level = level + 1

textdoc.styles.addElement(listhier)

l = List(stylename=listhier)
textdoc.text.addElement(l)
for x in [1,2,3,4]:
    elem = ListItem()
    elem.addElement(P(text="Listitem %d" % x))
    l.addElement(elem)


textdoc.save("list-example.odt")
Ejemplo n.º 18
0
      stylename='Text_20_body')
textdoc.text.addElement(p)

textdoc.text.addElement(H(outlinelevel=2,text='A simple series of paragraphs (Heading 2)'))
textdoc.text.addElement(P(text="This section contains a series of paragraphs.", 
stylename='Text_20_body'))
textdoc.text.addElement(P(text="This is a second paragraph.", 
stylename='Text_20_body'))
textdoc.text.addElement(P(text="And a third paragraph.", stylename='Text_20_body'))

textdoc.text.addElement(H(outlinelevel=2,text='A section with lists (Heading 2)'))
textdoc.text.addElement(P(text="Elements to illustrate:"))

# add the first list (unordered list)
textList = List(stylename="L1")
item = ListItem()
item.addElement(P(text='hyperlinks', stylename="P1"))
textList.addElement(item)

item = ListItem()
item.addElement(P(text='italics and bold text', stylename="P1"))
textList.addElement(item)

item = ListItem()
item.addElement(P(text='lists (ordered and unordered)', stylename="P1"))
textList.addElement(item)

textdoc.text.addElement(textList)

# add the second (ordered) list
Ejemplo n.º 19
0
    def __init__(self, dest, dico_layer, dico_fields, dico_profil, dico_rekurs, dico_text):
        """
        Parameters depending on Metadator main class
        dest : destination folder path
        dico_layer : dictionary about layer
        dico_fields : dictionary about layers's fields
        dico_profil : dictionary about profile selected informations
        dico_rekurs : dictionary about recurring fields
        dico_text : dictionary of text according to language selected
        """
        # creating the document
        doc_obj = OpenDocumentText()  # create a new document object

        # BASIC STYLES
        doc_styles = doc_obj.styles
        # styles settings
        StandardStyle = Style(name="Standard", family="paragraph")
        TextBodyStyle = Style(
            name="Text_20_body", family="paragraph", parentstylename="Standard", displayname="Text body"
        )
        TextBodyStyle.addElement(ParagraphProperties(margintop="0in", marginbottom="0.0835in"))

        # adding the styles
        doc_styles.addElement(StandardStyle)
        doc_styles.addElement(TextBodyStyle)

        # fonts
        doc_obj.fontfacedecls.addElement(
            (FontFace(name="Arial", fontfamily="Arial", fontfamilygeneric="swiss", fontpitch="variable"))
        )
        # AUTOMATIC STYLES
        # 1st type of paragraph (P1)
        P1_style = Style(name="P1", family="paragraph", parentstylename="Standard", liststylename="L1")
        doc_obj.automaticstyles.addElement(P1_style)
        # 2nd type of paragraph (P2)
        P2_style = Style(name="P2", family="paragraph", liststylename="L2")
        P2_style.addElement(TextProperties(fontweight="bold", fontweightasian="bold", fontweightcomplex="bold"))
        doc_obj.automaticstyles.addElement(P2_style)
        # List 1 (unordered)
        L1_style = ListStyle(name="L1")
        L1_bullet = ListLevelStyleBullet(
            level="1", stylename="Numbering_20_Symbols", numsuffix=".", bulletchar="\u2022"
        )  # bullet char (utf8)
        L1_prop = ListLevelProperties(spacebefore="0.25in", minlabelwidth="0.25in")
        L1_bullet.addElement(L1_prop)
        L1_style.addElement(L1_bullet)
        # adding the style
        doc_obj.automaticstyles.addElement(L1_style)
        # List 2 (ordered)
        L2_style = ListStyle(name="L2")
        L2_num = ListLevelStyleNumber(level="1", stylename="Numbering_20_Symbols", numsuffix=" - ", numformat="1")
        L2_prop = ListLevelProperties(spacebefore="0.25in", minlabelwidth="0.25in")
        L2_num.addElement(L2_prop)
        L2_style.addElement(L2_num)
        # adding the style
        doc_obj.automaticstyles.addElement(L2_style)

        # Text 5: bold
        T5_style = Style(name="T5", family="text")
        T5_style.addElement(TextProperties(color="#ff0000", fontname="Arial"))
        doc_obj.automaticstyles.addElement(T5_style)

        # Text 2: bold
        T2_style = Style(name="T2", family="text")
        T2_style.addElement(TextProperties(fontweight="bold", fontweightasian="bold", fontweightcomplex="bold"))
        doc_obj.automaticstyles.addElement(T2_style)

        # Table : cell formatting
        TAB_style = Style(name="Table", family="table-cell", parentstylename="Standard")
        TAB_style.addElement(TableCellProperties(border="0.05pt solid #000000"))
        doc_obj.automaticstyles.addElement(TAB_style)

        # BODY - table
        # table creation
        doc_table = Table(name="Metadata")
        doc_table.addElement(TableColumn(numbercolumnsrepeated="2"))

        # title
        tr_title = TableRow()
        doc_table.addElement(tr_title)
        # merged columns
        tc_1_title = TableCell(valuetype="string", stylename="Table", numbercolumnsspanned="2")
        tc_1_title.addElement(P(text="Metadata of %s" % dico_layer.get("title"), stylename="P1"))
        tr_title.addElement(tc_1_title)

        # file name
        tr_name = TableRow()
        doc_table.addElement(tr_name)
        # column 1
        tc_1_name = TableCell(valuetype="string", stylename="Table")
        tc_1_name.addElement(P(text=dico_text.get("nomfic"), stylename="P2"))
        tr_name.addElement(tc_1_name)
        # column 2
        tc_2_name = TableCell(valuetype="string", stylename="Table")
        tc_2_name.addElement(P(text=dico_layer.get("name")))
        tr_name.addElement(tc_2_name)

        # thematic keywords
        tr_themes = TableRow()
        doc_table.addElement(tr_themes)
        # column 1
        tc_1_themes = TableCell(valuetype="string", stylename="Table")
        tc_1_themes.addElement(P(text=dico_text.get("mtcthem"), stylename="P2"))
        tr_themes.addElement(tc_1_themes)
        # column 2
        tc_2_themes = TableCell(valuetype="string", stylename="Table")
        tc_2_themes.addElement(P(text=", ".join(dico_profil.get("keywords"))))
        tr_themes.addElement(tc_2_themes)

        # places keywords
        tr_places = TableRow()
        doc_table.addElement(tr_places)
        # column 1
        tc_1_places = TableCell(valuetype="string", stylename="Table")
        tc_1_places.addElement(P(text=dico_text.get("mtcgeo"), stylename="P2"))
        tr_places.addElement(tc_1_places)
        # column 2
        tc_2_places = TableCell(valuetype="string", stylename="Table")
        tc_2_places.addElement(P(text=", ".join(dico_profil.get("geokeywords"))))
        tr_places.addElement(tc_2_places)

        # description
        tr_description = TableRow()
        doc_table.addElement(tr_description)
        # column 1
        tc_1_description = TableCell(valuetype="string", stylename="Table")
        tc_1_description.addElement(P(text=dico_text.get("description"), stylename="P2"))
        tr_description.addElement(tc_1_description)
        # column 2
        tc_2_description = TableCell(valuetype="string", stylename="Table")
        tc_2_description.addElement(P(text=""))
        tr_description.addElement(tc_2_description)

        # context/summary
        tr_summary = TableRow()
        doc_table.addElement(tr_summary)
        # column 1
        tc_1_summary = TableCell(valuetype="string", stylename="Table")
        tc_1_summary.addElement(P(text=dico_text.get("cadre"), stylename="P2"))
        tr_summary.addElement(tc_1_summary)
        # column 2
        tc_2_summary = TableCell(valuetype="string", stylename="Table")
        tc_2_summary.addElement(P(text=dico_profil.get("description")))
        tr_summary.addElement(tc_2_summary)

        # objects count
        tr_features = TableRow()
        doc_table.addElement(tr_features)
        # column 1
        tc_1_features = TableCell(valuetype="string", stylename="Table")
        tc_1_features.addElement(P(text=dico_text.get("num_objets"), stylename="P2"))
        tr_features.addElement(tc_1_features)
        # column 2
        tc_2_features = TableCell(valuetype="string", stylename="Table")
        tc_2_features.addElement(P(text=dico_layer.get("num_obj")))
        tr_features.addElement(tc_2_features)

        # fields count
        tr_fields = TableRow()
        doc_table.addElement(tr_fields)
        # column 1
        tc_1_fields = TableCell(valuetype="string", stylename="Table")
        tc_1_fields.addElement(P(text=dico_text.get("num_attrib"), stylename="P2"))
        tr_fields.addElement(tc_1_fields)
        # column 2
        tc_2_fields = TableCell(valuetype="string", stylename="Table")
        tc_2_fields.addElement(P(text=dico_layer.get("num_fields")))
        tr_fields.addElement(tc_2_fields)

        # creation date (on computer)
        tr_date_crea = TableRow()
        doc_table.addElement(tr_date_crea)
        # column 1
        tc_1_date_crea = TableCell(valuetype="string", stylename="Table")
        tc_1_date_crea.addElement(P(text=dico_text.get("date_crea"), stylename="P2"))
        tr_date_crea.addElement(tc_1_date_crea)
        # column 2
        tc_2_date_crea = TableCell(valuetype="string", stylename="Table")
        tc_2_date_crea.addElement(P(text=dico_layer.get("date_crea")))
        tr_date_crea.addElement(tc_2_date_crea)

        # last update
        tr_date_up = TableRow()
        doc_table.addElement(tr_date_up)
        # column 1
        tc_1_date_up = TableCell(valuetype="string", stylename="Table")
        tc_1_date_up.addElement(P(text=dico_text.get("date_actu"), stylename="P2"))
        tr_date_up.addElement(tc_1_date_up)
        # column 2
        tc_2_date_up = TableCell(valuetype="string", stylename="Table")
        tc_2_date_up.addElement(P(text=dico_layer.get("date_actu")))
        tr_date_up.addElement(tc_2_date_up)

        # sources
        tr_sources = TableRow()
        doc_table.addElement(tr_sources)
        # column 1
        tc_1_sources = TableCell(valuetype="string", stylename="Table")
        tc_1_sources.addElement(P(text=dico_text.get("source"), stylename="P2"))
        tr_sources.addElement(tc_1_sources)
        # column 2
        tc_2_sources = TableCell(valuetype="string", stylename="Table")
        tc_2_sources.addElement(P(text=dico_profil.get("sources")))
        tr_sources.addElement(tc_2_sources)

        # global responsable
        tr_resp = TableRow()
        doc_table.addElement(tr_resp)
        # column 1
        tc_1_resp = TableCell(valuetype="string", stylename="Table")
        tc_1_resp.addElement(P(text=dico_text.get("responsable"), stylename="P2"))
        tr_resp.addElement(tc_1_resp)
        # column 2
        tc_2_resp = TableCell(valuetype="string", stylename="Table")
        tc_2_resp.addElement(
            P(
                text=dico_profil.get("resp_name")
                + " ("
                + dico_profil.get("resp_orga")
                + "), "
                + dico_profil.get("resp_mail")
            )
        )
        tr_resp.addElement(tc_2_resp)

        # point of contact
        tr_cont = TableRow()
        doc_table.addElement(tr_cont)
        # column 1
        tc_1_cont = TableCell(valuetype="string", stylename="Table")
        tc_1_cont.addElement(P(text=dico_text.get("ptcontact"), stylename="P2"))
        tr_cont.addElement(tc_1_cont)
        # column 2
        tc_2_cont = TableCell(valuetype="string", stylename="Table")
        tc_2_cont.addElement(
            P(
                text=dico_profil.get("cont_name")
                + " ("
                + dico_profil.get("cont_orga")
                + "), "
                + dico_profil.get("cont_mail")
            )
        )
        tr_cont.addElement(tc_2_cont)

        # URL
        tr_url = TableRow()
        doc_table.addElement(tr_url)
        # column 1
        tc_1_url = TableCell(valuetype="string", stylename="Table")
        tc_1_url.addElement(P(text=dico_text.get("siteweb"), stylename="P2"))
        tr_url.addElement(tc_1_url)
        # column 2
        tc_2_url = TableCell(valuetype="string", stylename="Table")
        urlink = A(type="simple", href=dico_profil.get("url"), text=dico_profil.get("url_label"))
        plink = P(text="")
        plink.addElement(urlink)
        tc_2_url.addElement(plink)
        tr_url.addElement(tc_2_url)

        # geometry type
        tr_geom = TableRow()
        doc_table.addElement(tr_geom)
        # column 1
        tc_1_geom = TableCell(valuetype="string", stylename="Table")
        tc_1_geom.addElement(P(text=dico_text.get("geometrie"), stylename="P2"))
        tr_geom.addElement(tc_1_geom)
        # column 2
        tc_2_geom = TableCell(valuetype="string", stylename="Table")
        tc_2_geom.addElement(P(text=dico_layer.get("type_geom")))
        tr_geom.addElement(tc_2_geom)

        # scale
        tr_scale = TableRow()
        doc_table.addElement(tr_scale)
        # column 1
        tc_1_scale = TableCell(valuetype="string", stylename="Table")
        tc_1_scale.addElement(P(text=dico_text.get("echelle"), stylename="P2"))
        tr_scale.addElement(tc_1_scale)
        # column 2
        tc_2_sources = TableCell(valuetype="string", stylename="Table")
        tc_2_sources.addElement(P(text="1:"))
        tr_scale.addElement(tc_2_sources)

        # precision
        tr_prec = TableRow()
        doc_table.addElement(tr_prec)
        # column 1
        tc_1_prec = TableCell(valuetype="string", stylename="Table")
        tc_1_prec.addElement(P(text=dico_text.get("precision"), stylename="P2"))
        tr_prec.addElement(tc_1_prec)
        # column 2
        tc_2_prec = TableCell(valuetype="string", stylename="Table")
        tc_2_prec.addElement(P(text=" m"))
        tr_prec.addElement(tc_2_prec)

        # SRS
        tr_srs = TableRow()
        doc_table.addElement(tr_srs)
        # column 1
        tc_1_srs = TableCell(valuetype="string", stylename="Table")
        tc_1_srs.addElement(P(text=dico_text.get("srs"), stylename="P2"))
        tr_srs.addElement(tc_1_srs)
        # column 2
        tc_2_srs = TableCell(valuetype="string", stylename="Table")
        srs_text = "SRS : %s\u000A%s%s" % (dico_layer.get("srs"), dico_text.get("codepsg"), dico_layer.get("EPSG"))
        tc_2_srs.addElement(P(text=srs_text))
        tr_srs.addElement(tc_2_srs)

        # spatial extension
        tr_extent = TableRow()
        doc_table.addElement(tr_extent)
        # column 1
        tc_1_extent = TableCell(valuetype="string", stylename="Table")
        tc_1_extent.addElement(P(text=dico_text.get("emprise"), stylename="P2"))
        tr_extent.addElement(tc_1_extent)
        # column 2
        tc_2_extent = TableCell(valuetype="string", stylename="Table")
        spatial_extent = "\tMax Y : %s \tMin X : %s\t\tMax X : %s\tMin Y : %s" % (
            dico_layer["Ymax"],
            dico_layer["Xmin"],
            dico_layer["Xmax"],
            dico_layer["Ymin"],
        )
        tc_2_extent.addElement(P(text=spatial_extent))
        tr_extent.addElement(tc_2_extent)

        # adding the table
        doc_obj.text.addElement(doc_table)

        ## BODY - attributes
        doc_obj.text.addElement(Section(name="Attributes"))
        doc_obj.text.addElement(H(outlinelevel=1, text=dico_text.get("listattributs")))
        x = 0  # rank of the field
        for chp in dico_fields.keys():
            """ parsing fields"""
            x = x + 1
            # field name
            try:
                """ check the encoding of the field name """
                p_name = P(text=str(x) + " - " + chp, stylename="P2")
            except UnicodeDecodeError:
                """ raise the exception and re-encode it """
                p_name = P(text=str(x) + " - " + chp.decode("latin1"), stylename="T2")
            doc_obj.text.addElement(p_name)

            # more friendly local variables
            lg = dico_fields.get(chp)[0][1]
            prec = dico_fields.get(chp)[0][2]
            desc = dico_fields.get(chp)[1]

            # field information depending on field type
            if dico_fields[chp][0][0] == "Integer":
                """ for integers """
                # type
                p_type = P(text="")
                s_type = Span(text=dico_text.get("type"), stylename="T2")
                p_type.addElement(s_type)
                p_type.addText(" %s" % dico_text.get("entier"))
                doc_obj.text.addElement(p_type)

                # length
                p_lg = P(text="")
                s_lg = Span(text=dico_text.get("longueur"), stylename="T2")
                p_lg.addElement(s_lg)
                p_lg.addText(" %s" % lg)
                doc_obj.text.addElement(p_lg)

                # description
                p_descr = P(text="")
                s_descr = Span(text=dico_text.get("description"), stylename="T2")
                p_descr.addElement(s_descr)
                p_descr.addText(" %s" % desc)
                doc_obj.text.addElement(p_descr)

                # basics stats only if there are'nt disabled
                if dico_fields[chp][2]:
                    # more friendly local variables
                    som = dico_fields[chp][2][0]
                    med = dico_fields[chp][2][1]
                    moy = dico_fields[chp][2][2]
                    uppest = dico_fields[chp][2][3]
                    bottom = dico_fields[chp][2][4]
                    freq = dico_fields[chp][2][5]
                    mod = dico_fields[chp][2][6]
                    ect = dico_fields[chp][2][7]
                    vid = dico_fields[chp][2][8]

                    # basics stats
                    p_stats = P(text="")
                    s_stats = Span(text=dico_text.get("statsbase"), stylename="T2")
                    p_stats.addElement(s_stats)
                    doc_obj.text.addElement(p_stats)
                    stats_list = List(stylename="L5")
                    item = ListItem()
                    item.addElement(P(text="%s (%s)" % (dico_text.get("somme"), som), stylename="P1"))
                    stats_list.addElement(item)
                    if vid != 0:  # for null values
                        perc = round(float(vid) * 100 / dico_layer.get("num_obj"), 2)
                        item = ListItem()
                        item.addElement(
                            P(
                                text="%s%s (%s %s%s)"
                                % (
                                    dico_text.get("valnulles"),
                                    vid,
                                    dico_text.get("soit"),
                                    perc,
                                    dico_text.get("perctotal"),
                                ),
                                stylename="P1",
                            )
                        )
                        stats_list.addElement(item)
                    item = ListItem()
                    item.addElement(P(text="%s%s" % (dico_text.get("min"), bottom), stylename="P1"))
                    stats_list.addElement(item)
                    item = ListItem()
                    item.addElement(P(text="%s%s" % (dico_text.get("max"), uppest), stylename="P1"))
                    stats_list.addElement(item)
                    item = ListItem()
                    item.addElement(P(text="%s%s" % (dico_text.get("moyenne"), moy), stylename="P1"))
                    stats_list.addElement(item)
                    item = ListItem()
                    item.addElement(P(text="%s%s" % (dico_text.get("mediane"), med), stylename="P1"))
                    stats_list.addElement(item)
                    item = ListItem()
                    item.addElement(P(text="%s%s" % (dico_text.get("ecartype"), ect), stylename="P1"))
                    stats_list.addElement(item)
                    doc_obj.text.addElement(stats_list)

                    # modalities
                    p_moda = P(text="")
                    s_moda = Span(text=dico_text.get("val_freq"), stylename="T2")
                    p_moda.addElement(s_moda)
                    p_moda.addText(" %s" % mod.replace("\n", "<br>"))
                    doc_obj.text.addElement(p_moda)
                    if freq > 0:
                        freq_list = List(stylename="L5")
                        for val, okur in freq:
                            item = ListItem()
                            item.addElement(P(text="%s (%s)" % (val, okur), stylename="P1"))
                            freq_list.addElement(item)
                    else:
                        pass
                    doc_obj.text.addElement(freq_list)
                else:
                    pass

            elif dico_fields[chp][0][0] == "Real":
                """ for real / float """
                # type
                p_type = P(text="")
                s_type = Span(text=dico_text.get("type"), stylename="T2")
                p_type.addElement(s_type)
                p_type.addText(" %s" % dico_text.get("reel"))
                doc_obj.text.addElement(p_type)

                # length
                p_lg = P(text="")
                s_lg = Span(text=dico_text.get("longueur"), stylename="T2")
                p_lg.addElement(s_lg)
                p_lg.addText(" %s" % lg)
                doc_obj.text.addElement(p_lg)

                # precision
                p_prec = P(text="")
                s_prec = Span(text=dico_text.get("precision"), stylename="T2")
                p_prec.addElement(s_prec)
                p_prec.addText(" %s" % prec)
                doc_obj.text.addElement(p_prec)

                # description
                p_descr = P(text="")
                s_descr = Span(text=dico_text.get("description"), stylename="T2")
                p_descr.addElement(s_descr)
                p_descr.addText(" %s" % desc)
                doc_obj.text.addElement(p_descr)

                # basics stats only if there are'nt disabled
                if dico_fields[chp][2]:
                    # more friendly local variables
                    som = dico_fields[chp][2][0]
                    med = dico_fields[chp][2][1]
                    moy = dico_fields[chp][2][2]
                    uppest = dico_fields[chp][2][3]
                    bottom = dico_fields[chp][2][4]
                    freq = dico_fields[chp][2][5]
                    mod = dico_fields[chp][2][6]
                    ect = dico_fields[chp][2][7]
                    vid = dico_fields[chp][2][8]

                    # basics stats
                    p_stats = P(text="")
                    s_stats = Span(text=dico_text.get("statsbase"), stylename="T2")
                    p_stats.addElement(s_stats)
                    doc_obj.text.addElement(p_stats)
                    stats_list = List(stylename="L5")
                    item = ListItem()
                    item.addElement(P(text="%s (%s)" % (dico_text.get("somme"), som), stylename="P1"))
                    stats_list.addElement(item)
                    if vid != 0:  # for null values
                        perc = round(float(vid) * 100 / dico_layer.get("num_obj"), 2)
                        item = ListItem()
                        item.addElement(
                            P(
                                text="%s%s (%s %s%s)"
                                % (
                                    dico_text.get("valnulles"),
                                    vid,
                                    dico_text.get("soit"),
                                    perc,
                                    dico_text.get("perctotal"),
                                ),
                                stylename="P1",
                            )
                        )
                        stats_list.addElement(item)
                    item = ListItem()
                    item.addElement(P(text="%s%s" % (dico_text.get("min"), bottom), stylename="P1"))
                    stats_list.addElement(item)
                    item = ListItem()
                    item.addElement(P(text="%s%s" % (dico_text.get("max"), uppest), stylename="P1"))
                    stats_list.addElement(item)
                    item = ListItem()
                    item.addElement(P(text="%s%s" % (dico_text.get("moyenne"), moy), stylename="P1"))
                    stats_list.addElement(item)
                    item = ListItem()
                    item.addElement(P(text="%s%s" % (dico_text.get("mediane"), med), stylename="P1"))
                    stats_list.addElement(item)
                    item = ListItem()
                    item.addElement(P(text="%s%s" % (dico_text.get("ecartype"), ect), stylename="P1"))
                    stats_list.addElement(item)
                    doc_obj.text.addElement(stats_list)

                    # modalities
                    p_moda = P(text="")
                    s_moda = Span(text=dico_text.get("val_freq"), stylename="T2")
                    p_moda.addElement(s_moda)
                    p_moda.addText(" %s" % mod.replace("\n", "<br>"))
                    doc_obj.text.addElement(p_moda)
                    if freq > 0:
                        freq_list = List(stylename="L5")
                        for val, okur in freq:
                            item = ListItem()
                            item.addElement(P(text="%s (%s)" % (val, okur), stylename="P1"))
                            freq_list.addElement(item)
                    else:
                        pass
                    doc_obj.text.addElement(freq_list)
                else:
                    pass

            elif dico_fields[chp][0][0] == "String":
                """ for caracter string """
                # type
                p_type = P(text="")
                s_type = Span(text=dico_text.get("type"), stylename="T2")
                p_type.addElement(s_type)
                p_type.addText(" %s" % dico_text.get("string"))
                doc_obj.text.addElement(p_type)

                # length
                p_lg = P(text="")
                s_lg = Span(text=dico_text.get("longueur"), stylename="T2")
                p_lg.addElement(s_lg)
                p_lg.addText(" %s" % lg)
                doc_obj.text.addElement(p_lg)

                # description
                p_descr = P(text="")
                s_descr = Span(text=dico_text.get("description"), stylename="T2")
                p_descr.addElement(s_descr)
                p_descr.addText(" %s" % desc)
                doc_obj.text.addElement(p_descr)

                # basics stats only if there are'nt disabled
                if dico_fields[chp][2]:
                    # more friendly local variables
                    mod = dico_fields[chp][2][0]
                    freq = dico_fields[chp][2][1]
                    vid = dico_fields[chp][2][2]

                    # modalities
                    p_moda = P(text="")
                    s_moda = Span(text=dico_text.get("txt_moda"), stylename="T2")
                    p_moda.addElement(s_moda)
                    p_moda.addText(" %s" % mod.replace("\n", "<br>"))
                    doc_obj.text.addElement(p_moda)
                    if freq > 0:
                        freq_list = List(stylename="L5")
                        for val, okur in freq:
                            item = ListItem()
                            try:
                                item.addElement(P(text="%s (%s)" % (val, okur), stylename="P1"))
                            except UnicodeDecodeError:
                                val = val.decode("latin1")
                                item.addElement(P(text="%s (%s)" % (val, okur), stylename="P1"))
                            freq_list.addElement(item)
                        # if null values
                        if vid != 0:
                            item = ListItem()
                            item.addElement(P(text="%s (%s)" % (dico_text.get("valnulles"), vid), stylename="P1"))
                            freq_list.addElement(item)
                        else:
                            pass
                        doc_obj.text.addElement(freq_list)
                    else:
                        pass

            elif dico_fields[chp][0][0] == "Date":
                """ for dates """
                # type
                p_type = P(text="")
                s_type = Span(text=dico_text.get("type"), stylename="T2")
                p_type.addElement(s_type)
                p_type.addText(" %s" % dico_text.get("date"))
                doc_obj.text.addElement(p_type)

                # description
                p_descr = P(text="")
                s_descr = Span(text=dico_text.get("description"), stylename="T2")
                p_descr.addElement(s_descr)
                p_descr.addText(" %s" % desc)
                doc_obj.text.addElement(p_descr)

                # basics stats only if there are'nt disabled
                if dico_fields[chp][2]:
                    # more friendly local variables
                    uppest = dico_fields[chp][2][0]
                    bottom = dico_fields[chp][2][1]
                    diffdays = dico_fields[chp][2][2]
                    freq = dico_fields[chp][2][3]
                    mod = dico_fields[chp][2][4]
                    vid = dico_fields[chp][2][5]

                    # dates delta
                    if vid != dico_layer.get("num_obj"):
                        """ check if attribute is empty """
                        # oldest
                        p_old = P(text="")
                        s_old = Span(text=dico_text.get("datancienne"), stylename="T2")
                        p_old.addElement(s_old)
                        p_old.addText(" %s" % date.isoformat(bottom))
                        doc_obj.text.addElement(p_old)

                        # recent
                        p_rec = P(text="")
                        s_rec = Span(text=dico_text.get("daterecente"), stylename="T2")
                        p_rec.addElement(s_rec)
                        p_rec.addText(" %s" % date.isoformat(uppest))
                        doc_obj.text.addElement(p_rec)

                        # interval
                        p_interv = P(text="")
                        s_interv = Span(text=dico_text.get("date_intervmax"), stylename="T2")
                        p_interv.addElement(s_interv)
                        p_interv.addText(" %s" % diffdays)
                        doc_obj.text.addElement(p_interv)

            # separating line
            doc_obj.text.addElement(P(text="______________________________________\n"))

            ## END
        # saving the document
        output = path.join(dest, "{0}_MD.odt".format(dico_layer.get("name")[:-4]))
        doc_obj.save(output)