Python: spire.doc

发布时间 2024-01-13 10:50:18作者: ®Geovin Du Dream Park™

 

# encoding: utf-8
# 版权所有 2024 涂聚文有限公司
# 许可信息查看:
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# Datetime  : 2024/1/13 10:21
# User      : geovindu
# Product   : PyCharm
# Project   : pyBaiduAi
# File      : CreateDoc.py
# explain   : 学习
from spire.doc import *
from spire.doc.common import *


class CreateDocx(object):
    """
    创建DOC
    """
    def simpledoct(self,fileanme):
        """
        有多添版权的文字,需要购买
        :param fileanme:
        :return:
        """
        outputFile =fileanme
        #Create a document
        doc = Document()
        #Add a section
        section = doc.AddSection()
        #Customize table of contents with switches
        toc = TableOfContent(doc, "{\\o \"1-3\" \\n 1-1}")
        para = section.AddParagraph()
        para.Items.Add(toc)
        para.AppendFieldMark(FieldMarkType.FieldSeparator)
        para.AppendText("TOC")  #创建索此目录
        para.AppendFieldMark(FieldMarkType.FieldEnd)
        doc.TOC = toc
        par = section.AddParagraph()
        tr = par.AppendText("科学之花")
        tr.CharacterFormat.FontSize = 30
        par.Format.HorizontalAlignment = HorizontalAlignment.Center
        #Create paragraph and set the head level
        para1 = section.AddParagraph()
        para1.AppendText("帝制國家控制其臣民的方式")
        #Apply the Heading1 style
        para1.ApplyStyle(BuiltinStyle.Heading1)
        #Add paragraphs
        para1 = section.AddParagraph()
        picture = para1.AppendPicture("./man/face_10.jpg")
        picture.TextWrappingStyle = TextWrappingStyle.Square
        para1.AppendText("蕭公權先生曾論及帝制國家控制其臣民的方式,主要有三:一是通過照顧臣民基本的物質需求,避免臣民因難以忍受艱困的生活“挺而走險”;二則通過向臣民反復灌輸精心篩選的道德教條(大部分是從儒家學說中篩選出來的),使臣民接受或認同現存的統治秩序;三則通過不斷監視臣民,從而查出“奸民”並及時加以處理。張榮明先生則認為:西周時代行政組織的主體是以宗族為機制的血緣組織,而“以地緣為基礎的行政區域的劃分是西周血緣組織的崩潰的結果,是春秋戰國社會變革形成的社會制度”。--《中國古代鄉里制度研究》 魯西奇著,北京大學出版社  2021年4月涂聚文,Geovin Du For normally we think of science as the very paradigm of rational enquiry.在通常情况下,我们认为科学正是理性探究的范式。	--《Philosophy of Science -- A Very Short introduction》 by Samir Okasha 韩国忠译 译林出版社  2013年6月 Ornithogalum is a genus of perennial plants mostly native to southern Europe and southern Africa belonging to the family Asparagaceae. Some species are native to other areas such as the Caucasus. Growing from a bulb, species have linear basal leaves and a slender stalk, up to 30 cm tall, bearing clusters of typically white star-shaped flowers, often striped with green.")
        para1 = section.AddParagraph()
        para2 = section.AddParagraph()
        para2.AppendText("法律面前人人平等")
        #Apply the Heading2 style
        para2.ApplyStyle(BuiltinStyle.Heading2)
        para2 = section.AddParagraph()
        picture2 = para2.AppendPicture("./man/face_11.jpg")
        picture2.TextWrappingStyle = TextWrappingStyle.Square
        para2.AppendText("天下熙熙皆为利来,天下攘攘皆为利往!…….胡文強調指出:“法律面前人人平等”是社會主義法制的一項基本原則,須在立法上、執法上、司法上全面地完整地實現。立法平等與司法平等具有內在的統一關係。一方面,立法是先決問題,沒有立法平等,就沒有真正的適用法律的平等,就沒有平等的司法結果。另一方面,必須重視適用法律上的人人平等。如果只有人人平等的立法,而沒有適用法律的人人平等,那麼法律也只不過是一紙空文,“法律面前人人平等”也不能實現。第四,“法律適用”本身並沒有平等與不平等之分。在《關於“法律面前人人平等”的問題》一文發表之後,針對來自多方面的反對意見,潘念之、齊乃寬在《再論“法律面前人人平等”的問題》中繼續強調:“法律面前人人平等”原則的意義是反對特權、要求民主,是政治上的權利平等,經濟上不受剝削的平等,不是什麼別的平等。它通過立法,在法律上規定這種平等原則,通過執法,對人們實現這種平等精神。.....法律適用上的平等,也是一種平等,但不是“法律面前人人平等”的本意,而是依法辦事(其實只是依法判決)。依法辦事,本身沒有獨立的意義,沒有什麼平等和不平等,僅因所依的法而產生不同的作用。只有法律的內容是平等的,其適用能夠發揮平等的作用,如果法律的內容是不平等的,其適用只是鞏固不平等。第五,關於社會主義法的階級性與平等性的關係。針對法學界關於“立法平等論”的種種批評,潘念之、齊乃寬在《再論“法律而前人人平等”的問題》中,闡述了這樣的觀點,即要把平等理解為消滅階級,否則平等就是一句空話。有階級就沒有平等,在“消滅階級”的前提下,階級對抗關係不存在,平等才能擴大到全體公民,獲得真正意義上的實現。社會主義法律體現無產階級的意志,維護無產階級領導的廣大人民的利益,當然有其階級性。它的階級性就是要消滅剝削、消滅階級。既然消滅階級就是平等,社會主義法律也就存在著平等性。階級性與平等性同時存在於社會主義法律當中,兩者是相一致而不矛盾的。……   --《共和國六十年法學論爭實錄—法理學卷》 江平總主編 第四專題 平等與分層—關於法律平等問題之爭論 第114,115頁   廈門大學出版社  2009年10月A rose is a woody perennial flowering plant of the genus Rosa, in the family Rosaceae, or the flower it bears. There are over a hundred species and thousands of cultivars. They form a group of plants that can be erect shrubs, climbing or trailing with stems that are often armed with sharp prickles. Flowers vary in size and shape and are usually large and showy, in colours ranging from white through yellows and reds. Most species are native to Asia, with smaller numbers native to Europe, North America, and northwestern Africa. Species, cultivars and hybrids are all widely grown for their beauty and often are fragrant. Roses have acquired cultural significance in many societies. Rose plants range in size from compact, miniature roses, to climbers that can reach seven meters in height. Different species hybridize easily, and this has been used in the development of the wide range of garden roses.")
        section.AddParagraph()
        para3 = section.AddParagraph()
        para3.AppendText("言語成了搶功盡責的功臣")
        #Apply the Heading3 style
        para3.ApplyStyle(BuiltinStyle.Heading3)
        para3 = section.AddParagraph()
        picture3 = para3.AppendPicture("./man/face_12.jpg")
        picture3.TextWrappingStyle = TextWrappingStyle.Tight
        para3.AppendText("言語成了搶功盡責的功臣,還要行為來值班嗎? 在其一般意義上,政府正義,即政府對社會公共事務進行管理的一種合理狀態,意味著政府不妨礙且促進權利和義務、資源與利益在社會成員之間的適當安排和合理分配。在其法哲學層面,政府正義的核心命題是“如何通過一個‘善’的政治過程及制度建設實現整個社會的正義或者一個正義的社會”在這個意義上,政府正義包含了兩層含義:一是政府本身應當是正義的一包括政府的產生和運行過程都應當合乎正義原理;二是政府是應當為實現正義而存在的--社會正義的實現,是需要政府這個存在的,而政府存在的根本價值,正在于實現社會正義。	--法治政府要論叢書 《法治政府要論--基本原則》江國華 著  武漢大學出版社  2020年12月上野:成为女性主义者与爱人完全不矛盾。年轻人的爱是斗争,而成年人的爱,是接纳与宽容。美国一位女诗人Adrienne Rich写过这么一句诗:“Two people together is a miracle.”(两个人能在一起,就是种奇迹。)Hyacinthus is a small genus of bulbous, fragrant flowering plants in the family Asparagaceae, subfamily Scilloideae.These are commonly called hyacinths.The genus is native to the eastern Mediterranean (from the south of Turkey through to northern Israel).")
        para3 = section.AddParagraph()
        para3.AppendText("“什麼屬於或什麼不屬於“政治的”範疇決定著“政治思想”的範圍,而政治思想本身的特性仍然是個問題。移民、國際貿易、環境保護、人權、恐怖主義、文化認同、社會科學和美學領域日新月異的語彙、新社會運動、不斷變化的國家和社會構成,所有這些以及其他發展趨勢共同決定了現代(以及有爭議的後現代)政治思想的特質。--《The Cambridge history of twentieth-century political thought 劍橋二十世紀政治思想史》 by Edited By Terence Ball and Richard Bellamy 任軍鋒、徐衛翔譯 商務印書館 2016年1月不想结婚”是个人自由,“不该结婚”是强制观念。“不需要男人”是个人自由,“不该对男人有需求”是原教旨主义。女性主义是追求个人自由的思想,因此,我们也必须尊重他人的自由。少数派的理论容易滑向极端原教旨主义,并造成女性主义的断裂。大家都该仔细想想,谁才是我们“共同的敌人”。Several species of Brodiea, Scilla, and other plants that were formerly classified in the lily family and have flower clusters borne along the stalk also have common names with the word \"hyacinth\" in them. Hyacinths should also not be confused with the genus Muscari, which are commonly known as grape hyacinths.")
        #Update TOC
        doc.UpdateTableOfContents()
        #Save to file
        doc.SaveToFile(outputFile, FileFormat.Docx)
        doc.Close()

   生成的文档: