Re: The problem with not owning the software

Liste des GroupesRevenir à ol advocacy 
Sujet : Re: The problem with not owning the software
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.linux.advocacy
Date : 05. Jan 2025, 01:37:32
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vlck8b$mcpa$8@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Pan/0.161 (Chasiv Yar; )
On Sat, 4 Jan 2025 10:32:52 -0500, DFS wrote:

I've been itching for the better part of 20 years for a cola-based MS
Office detractor to do some significant LO/Basic coding so it could be
compared to my Office/VBA.

Do you have an equivalent to this <https://github.com/eea/odfpy>?

Here’s just one part of my invoice-formatting code:

        def write_invoice_header(self, invoice) :
            self.doc = odf.opendocument.OpenDocumentText()
            self.invoice_prefix = invoice["invoice_prefix"]

            now = time.time()
            for \
                this_meta \
            in \
                (
                    odf.dc.Title(text = "Invoice for %s" % invoice["client_name"].split("\n", 1)[0]),
                    odf.dc.Creator(text = "Geek Central Business"),
                    odf.meta.CreationDate(text = format_odf_time(now)),
                    odf.dc.Date(text = format_odf_time(now)), # interpreted by OOo as modification date
                ) \
            :
                self.doc.meta.addElement(this_meta)
            #end for

            self.doc.fontfacedecls.addElement \
              (
                odf.style.FontFace
                  (
                    name = invoice_font,
                    fontfamilygeneric = "roman",
                    fontpitch = "variable"
                  )
              )
            default_text_properties = odf.style.TextProperties \
              (
                fontname = invoice_font,
                fontfamilygeneric = "roman"
              )
            default_text_properties.setAttrNS(odf.namespaces.FONS, "font-family", invoice_font)
            link_element \
              (
                construct = odf.style.DefaultStyle,
                attrs = dict(family = "paragraph"),
                parent = self.doc.styles,
                children =
                    (
                        default_text_properties,
                        odf.style.ParagraphProperties
                          (
                            marginbottom = "0.21cm",
                            lineheight = "115%",
                          ),
                    )
              )

            self.doc.text.addElement \
              (
                odf.text.P
                  (
                    stylename = link_element
                      (
                        construct = odf.style.Style,
                        attrs = dict(name = "top title", family = "paragraph"),
                        parent = self.doc.automaticstyles,
                        children =
                            (
                                odf.style.ParagraphProperties
                                  (
                                    textalign = "center",
                                    marginbottom = "0.71cm"
                                  ),
                            )
                      ),
                    text = "%(gst)sINVOICE" % {"gst" : ("", "TAX ")[self.gst_rate != None]}
                  )
              )

            cust_info_item_attrs = dict \
              (
                textindent = "-2.0cm", # counteract marginleft on first line
                marginleft = "2.0cm", # indent for lines after first
              )
            cust_info_item_style = link_element \
              (
                construct = odf.style.Style,
                attrs = dict(name = "cust info item", family = "paragraph"),
                parent = self.doc.automaticstyles,
                children =
                    (
                        odf.style.ParagraphProperties(**cust_info_item_attrs),
                    )
              )
            cust_info_item_attrs["breakbefore"] = "column"
            cust_info_item_style_2 = link_element \
              (
                construct = odf.style.Style,
                attrs = dict(name = "cust info item 2", family = "paragraph"),
                parent = self.doc.automaticstyles,
                children =
                    (
                        odf.style.ParagraphProperties(**cust_info_item_attrs),
                    )
              )

            cust_info_style = link_element \
              (
                construct = odf.style.Style,
                attrs = dict(name = "cust info", family = "section"),
                parent = self.doc.automaticstyles,
                children =
                    (
                        link_element \
                          (
                            construct = odf.style.SectionProperties,
                            children =
                                (
                                    odf.style.Columns(columncount = 2),
                                )
                          ),
                    )
              )
            cust_info_name_style = link_element \
              (
                construct = odf.style.Style,
                attrs = dict(name = "cust info name", family = "text"),
                parent = self.doc.automaticstyles,
                children =
                    (
                        odf.style.TextProperties(fontweight = "bold"),
                    )
              )

            cust_info = odf.text.Section(name = "cust info", stylename = cust_info_style)
            for \
                item_name, item_value, new_col \
            in \
                (
                    (
                        ("Client", invoice["client_name"] + "\n" + invoice["client_address"], False),
                        ("Contact", invoice["client_contact"], False),
                        ("Date", format_pretty_date(invoice["when_generated"]), True),
                        (
                            "Pay to",
                                "\n".join((details.name, details.address_1, details.address_2))
                            +
                                (
                                    "\n" + details.country_name,
                                    "",
                                )[self.gst_rate != None],
                            False
                        ),
                        ("Bank a/c", details.bank_account, False),
                    )
                +
                    (
                        (),
                        (
                            ("GST No", details.ird_nr, False),
                        )
                    )[self.gst_rate != None]
                ) \
            :
                this_item = odf.text.P \
                  (
                    stylename = (cust_info_item_style, cust_info_item_style_2)[new_col]
                  )
                add_elements \
                  (
                    this_item,
                    odf.text.Span(stylename = cust_info_name_style, text = item_name),
                    odf.text.Tab(),
                  )
                first_line = True
                for line in item_value.split("\n") :
                    if not first_line :
                        this_item.addElement(odf.text.LineBreak())
                    #end if
                    this_item.addElement \
                      (
                        odf.text.Span(text = line)
                      )
                    first_line = False
                #end for
                cust_info.addElement(this_item)
            #end for
            self.doc.text.addElement(cust_info)

            link_element \
              (
                construct = odf.text.P,
                attrs = dict
                  (
                    stylename = link_element
                      (
                        construct = odf.style.Style,
                        attrs = dict(name = "work header", family = "paragraph"),
                        parent = self.doc.automaticstyles,
                        children =
                            (
                                odf.style.TextProperties(fontweight = "bold"),
                                link_element
                                  (
                                    construct = odf.style.ParagraphProperties,
                                    children =
                                        (
                                            make_tab_stops((dict(position = "15.1cm"),)),
                                        )
                                  ),
                            )
                      )
                  ),
                parent = self.doc.text,
                children =
                    (
                        odf.text.Span(text = "Description of Work"),
                        odf.text.Tab(),
                        odf.text.Span(text = "Charge"),
                    )
              )
            self.work_item_tabs = \
                (
                    dict
                      (
                        type = "char",
                        char = ".",
                        position = "15.9cm"
                      ),
                ) # I can't simply build one odf.style.TabStops object and reuse it
            self.work_item_style = link_element \
              (
                construct = odf.style.Style,
                attrs = dict(name = "work item", family = "paragraph"),
                parent = self.doc.automaticstyles,
                children =
                    (
                        link_element
                          (
                            construct = odf.style.ParagraphProperties,
                            children =
                                (
                                    make_tab_stops(self.work_item_tabs),
                                )
                          ),
                    )
              )
        #end write_invoice_header

I can post more, if you like.

Date Sujet#  Auteur
21 Dec 24 * Re: The problem with not owning the software200Mr. Man-wai Chang
23 Dec 24 +* Re: The problem with not owning the software179Mr. Man-wai Chang
24 Dec 24 i`* Re: The problem with not owning the software178Ant
25 Dec 24 i +* Re: The problem with not owning the software176Mr. Man-wai Chang
25 Dec 24 i i+- Re: The problem with not owning the software1Ant
25 Dec 24 i i`* Re: The problem with not owning the software174Lawrence D'Oliveiro
27 Dec 24 i i `* Re: The problem with not owning the software173Mr. Man-wai Chang
28 Dec 24 i i  +* Re: The problem with not owning the software157Lawrence D'Oliveiro
28 Dec 24 i i  i+- Re: The problem with not owning the software1Mr. Man-wai Chang
28 Dec 24 i i  i`* Re: The problem with not owning the software155rbowman
29 Dec 24 i i  i +* Re: The problem with not owning the software107rbowman
29 Dec 24 i i  i i+* Re: The problem with not owning the software93Ant
29 Dec 24 i i  i ii+* Re: The problem with not owning the software26rbowman
29 Dec 24 i i  i iii`* Re: The problem with not owning the software25Carlos E.R.
29 Dec 24 i i  i iii +* Re: The problem with not owning the software15Frank Slootweg
29 Dec 24 i i  i iii i`* Re: The problem with not owning the software14Carlos E.R.
30 Dec 24 i i  i iii i `* Re: The problem with not owning the software13Frank Slootweg
31 Dec 24 i i  i iii i  `* Re: The problem with not owning the software12Carlos E.R.
31 Dec 24 i i  i iii i   `* Re: The problem with not owning the software11Frank Slootweg
31 Dec 24 i i  i iii i    +* Re: The problem with not owning the software9Chris Ahlstrom
31 Dec 24 i i  i iii i    i+* Re: The problem with not owning the software6rbowman
1 Jan 25 i i  i iii i    ii`* Re: The problem with not owning the software5Chris Ahlstrom
2 Jan 25 i i  i iii i    ii `* Re: The problem with not owning the software4rbowman
2 Jan 25 i i  i iii i    ii  `* Re: The problem with not owning the software3Chris
2 Jan 25 i i  i iii i    ii   `* Re: The problem with not owning the software2rbowman
4 Jan 25 i i  i iii i    ii    `- Re: The problem with not owning the software1Chris
31 Dec 24 i i  i iii i    i`* Re: The problem with not owning the software2Farley Flud
4 Jan 25 i i  i iii i    i `- Re: The problem with not owning the software1DFS
31 Dec 24 i i  i iii i    `- Re: The problem with not owning the software1Carlos E.R.
29 Dec 24 i i  i iii +- Re: The problem with not owning the software1rbowman
29 Dec 24 i i  i iii +- Re: The problem with not owning the software1Lawrence D'Oliveiro
30 Dec 24 i i  i iii +* Re: The problem with not owning the software4-hh
30 Dec 24 i i  i iii i+- Re: The problem with not owning the software1Carlos E.R.
30 Dec 24 i i  i iii i`* Re: The problem with not owning the software2Lawrence D'Oliveiro
30 Dec 24 i i  i iii i `- Re: The problem with not owning the software1rbowman
30 Dec 24 i i  i iii `* Re: The problem with not owning the software3Chris
31 Dec 24 i i  i iii  `* Re: The problem with not owning the software2Lawrence D'Oliveiro
31 Dec 24 i i  i iii   `- Re: The problem with not owning the software1Chris
29 Dec 24 i i  i ii+- Re: The problem with not owning the software1rbowman
29 Dec 24 i i  i ii`* Re: The problem with not owning the software65Frank Slootweg
29 Dec 24 i i  i ii `* Re: The problem with not owning the software64rbowman
30 Dec 24 i i  i ii  `* Re: The problem with not owning the software63-hh
30 Dec 24 i i  i ii   +* Re: The problem with not owning the software3Lawrence D'Oliveiro
30 Dec 24 i i  i ii   i`* Re: The problem with not owning the software2-hh
31 Dec 24 i i  i ii   i `- Re: The problem with not owning the software1Lawrence D'Oliveiro
30 Dec 24 i i  i ii   +* Re: The problem with not owning the software2rbowman
30 Dec 24 i i  i ii   i`- Re: The problem with not owning the software1-hh
30 Dec 24 i i  i ii   `* Re: The problem with not owning the software57Chris
31 Dec 24 i i  i ii    `* Re: The problem with not owning the software56Lawrence D'Oliveiro
1 Jan 25 i i  i ii     `* Re: The problem with not owning the software55Chris
1 Jan 25 i i  i ii      `* Re: The problem with not owning the software54Lawrence D'Oliveiro
1 Jan 25 i i  i ii       +* Re: The problem with not owning the software3DFS
1 Jan 25 i i  i ii       i+- Re: The problem with not owning the software1Lawrence D'Oliveiro
2 Jan 25 i i  i ii       i`- Re: The problem with not owning the software1rbowman
2 Jan 25 i i  i ii       +- Re: The problem with not owning the software1rbowman
2 Jan 25 i i  i ii       `* Re: The problem with not owning the software49Paul
2 Jan 25 i i  i ii        +- Re: The problem with not owning the software1Lawrence D'Oliveiro
2 Jan 25 i i  i ii        `* Re: The problem with not owning the software47Chris
2 Jan 25 i i  i ii         `* Re: The problem with not owning the software46Lawrence D'Oliveiro
4 Jan 25 i i  i ii          `* Re: The problem with not owning the software45Chris
4 Jan 25 i i  i ii           `* Re: The problem with not owning the software44Lawrence D'Oliveiro
4 Jan 25 i i  i ii            +* Re: The problem with not owning the software4Chris
5 Jan 25 i i  i ii            i`* Re: The problem with not owning the software3Lawrence D'Oliveiro
5 Jan 25 i i  i ii            i `* Re: The problem with not owning the software2Chris
5 Jan 25 i i  i ii            i  `- Re: The problem with not owning the software1Lawrence D'Oliveiro
4 Jan 25 i i  i ii            +* Re: The problem with not owning the software10DFS
4 Jan 25 i i  i ii            i+* Re: The problem with not owning the software2vallor
4 Jan 25 i i  i ii            ii`- Re: The problem with not owning the software1Chris Ahlstrom
4 Jan 25 i i  i ii            i`* Re: The problem with not owning the software7DFS
4 Jan 25 i i  i ii            i +* Re: The problem with not owning the software5Stéphane CARPENTIER
4 Jan 25 i i  i ii            i i`* Re: The problem with not owning the software4DFS
4 Jan 25 i i  i ii            i i `* Re: The problem with not owning the software3Stéphane CARPENTIER
5 Jan 25 i i  i ii            i i  `* The Desktop Environment (was: Re: The problem with not owning the software)2vallor
5 Jan 25 i i  i ii            i i   `- Re: The Desktop Environment (was: Re: The problem with not owning the software)1pothead
4 Jan 25 i i  i ii            i `- Re: The problem with not owning the software1rbowman
4 Jan 25 i i  i ii            +* Re: The problem with not owning the software28Frank Slootweg
4 Jan 25 i i  i ii            i`* Re: The problem with not owning the software27Sn!pe
5 Jan 25 i i  i ii            i `* Re: The problem with not owning the software26Lawrence D'Oliveiro
5 Jan 25 i i  i ii            i  +* Re: The problem with not owning the software14Chris
5 Jan 25 i i  i ii            i  i+- Re: The problem with not owning the software1Sn!pe
5 Jan 25 i i  i ii            i  i`* Re: The problem with not owning the software12Lawrence D'Oliveiro
5 Jan 25 i i  i ii            i  i `* Re: The problem with not owning the software11Chris
6 Jan 25 i i  i ii            i  i  `* Re: The problem with not owning the software10Lawrence D'Oliveiro
6 Jan 25 i i  i ii            i  i   `* Re: The problem with not owning the software9Chris
6 Jan 25 i i  i ii            i  i    `* Re: The problem with not owning the software8Lawrence D'Oliveiro
7 Jan 25 i i  i ii            i  i     `* Re: The problem with not owning the software7Chris
7 Jan 25 i i  i ii            i  i      `* Re: The problem with not owning the software6Lawrence D'Oliveiro
7 Jan 25 i i  i ii            i  i       +- Re: The problem with not owning the software1rbowman
7 Jan 25 i i  i ii            i  i       `* Re: The problem with not owning the software4Chris
8 Jan03:26 i i  i ii            i  i        `* Re: The problem with not owning the software3Lawrence D'Oliveiro
8 Jan14:28 i i  i ii            i  i         `* Re: The problem with not owning the software2Chris
8 Jan22:28 i i  i ii            i  i          `- Re: The problem with not owning the software1Lawrence D'Oliveiro
5 Jan 25 i i  i ii            i  +* [OT] Re: The problem with not owning the software5Sn!pe
5 Jan 25 i i  i ii            i  i`* Re: [OT] Re: The problem with not owning the software4Lawrence D'Oliveiro
5 Jan 25 i i  i ii            i  i `* Re: [OT] Re: The problem with not owning the software3Sn!pe
5 Jan 25 i i  i ii            i  i  `* Re: [OT] Re: The problem with not owning the software2Lawrence D'Oliveiro
8 Jan18:21 i i  i ii            i  i   `- Re: [OT] Re: The problem with not owning the software1DFS
5 Jan 25 i i  i ii            i  +* [OT] Re: The problem with not owning the software5Sn!pe
5 Jan 25 i i  i ii            i  i+* Re: [OT] Re: The problem with not owning the software3-hh
5 Jan 25 i i  i ii            i  ii`* Re: [OT] Re: The problem with not owning the software2Chris Ahlstrom
5 Jan 25 i i  i ii            i  ii `- Re: [OT] Re: The problem with not owning the software1-hh
5 Jan 25 i i  i ii            i  i`- Re: [OT] Re: The problem with not owning the software1Sn!pe
5 Jan 25 i i  i ii            i  `- Re: The problem with not owning the software1Chris
5 Jan 25 i i  i ii            `- Re: The problem with not owning the software1Paul
29 Dec 24 i i  i i`* Re: The problem with not owning the software13rbowman
29 Dec 24 i i  i +* Re: The problem with not owning the software7rbowman
29 Dec 24 i i  i +- Re: The problem with not owning the software1Ken Blake
29 Dec 24 i i  i +* Re: The problem with not owning the software17-hh
30 Dec 24 i i  i +- Re: The problem with not owning the software1Chris
31 Dec 24 i i  i +- Re: The problem with not owning the software1DFS
1 Jan 25 i i  i +- Re: The problem with not owning the software1Physfitfreak
2 Jan 25 i i  i `* Re: The problem with not owning the software19Chris
31 Dec 24 i i  `* Re: The problem with not owning the software15DFS
25 Dec 24 i `- Re: The problem with not owning the software1Mr. Man-wai Chang
30 Dec 24 +* Re: The problem with not owning the software16Chris
31 Dec 24 `* Re: The problem with not owning the software4DFS

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal