标宋2号 仿宋3号 调整行间距

1.标宋2号的样式:
.tbs2
{
    font-family: "标宋";
    font-size: 29px;
    font-weight: bold;
    color:Black;
    text-decoration: none;}
2.仿宋3号字体样式表:
.t12 {
    font-family: "仿宋_GB2312";
    font-size: 21px;
    line-height: 16px;
    color: #000000;
    text-decoration: none;
}
3.调整行间距:    line-height: 16px;
LINE-HEIGHT定义行高,150%是指高度为标准高度的150%,也可以写作:LINE-HEIGHT:1.5或者LINE-HEIGHT:1.5em,都是一
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
抱歉,我无法编写程序,但我可以给您提供思路和示例代码。 思路: 1. 创建一个可视化界面,包含两个输入框和一个提交按钮。 2. 使用 PyQt 或 PySide2 实现界面。 3. 在提交按钮的点击事件中,获取输入框中的内容,根据要求设置不同的字体和字,最终生成一个 Word 文档。 示例代码: ```python import sys from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QTextEdit, QPushButton from PyQt5.QtGui import QFont, QTextDocument, QTextCursor from PyQt5.QtCore import Qt import docx class MyWindow(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.setGeometry(200, 200, 500, 500) self.setWindowTitle('写作模版程序') # 标题输入框 self.label1 = QLabel(self) self.label1.setText('标题:') self.label1.move(50, 50) self.line1 = QLineEdit(self) self.line1.setGeometry(100, 50, 300, 30) # 正文输入框 self.label2 = QLabel(self) self.label2.setText('正文:') self.label2.move(50, 100) self.text1 = QTextEdit(self) self.text1.setGeometry(100, 100, 300, 300) # 提交按钮 self.btn = QPushButton(self) self.btn.setText('提交') self.btn.setGeometry(200, 420, 100, 50) self.btn.clicked.connect(self.submit) def submit(self): # 获取标题和正文内容 title = self.line1.text() content = self.text1.toPlainText() # 新建 Word 文档 doc = docx.Document() # 设置标题格式 title_para = doc.add_paragraph() title_para.add_run(title).font.name = '仿宋' title_para.add_run('\n') title_para.add_run('\n') title_para.paragraph_format.alignment = docx.enum.text.WD_ALIGN_PARAGRAPH.CENTER title_para.paragraph_format.line_spacing = 1.5 title_para.paragraph_format.space_before = docx.shared.Pt(18) title_para.paragraph_format.space_after = docx.shared.Pt(18) title_para.paragraph_format.keep_with_next = True title_para.paragraph_format.keep_together = True title_para.paragraph_format.page_break_before = False title_para.paragraph_format.right_indent = docx.shared.Pt(0) title_para.paragraph_format.left_indent = docx.shared.Pt(0) title_para.paragraph_format.first_line_indent = docx.shared.Pt(0) title_para.paragraph_format.widow_control = True # 设置正文格式 content_para = doc.add_paragraph() content_para.add_run(content).font.name = '黑体' content_para.paragraph_format.alignment = docx.enum.text.WD_ALIGN_PARAGRAPH.LEFT content_para.paragraph_format.line_spacing = 1.5 content_para.paragraph_format.space_before = docx.shared.Pt(12) content_para.paragraph_format.space_after = docx.shared.Pt(12) content_para.paragraph_format.keep_with_next = False content_para.paragraph_format.keep_together = False content_para.paragraph_format.page_break_before = False content_para.paragraph_format.right_indent = docx.shared.Pt(0) content_para.paragraph_format.left_indent = docx.shared.Pt(0) content_para.paragraph_format.first_line_indent = docx.shared.Pt(0) content_para.paragraph_format.widow_control = True # 保存 Word 文档 doc.save(title + '.docx') if __name__ == '__main__': app = QApplication(sys.argv) window = MyWindow() window.show() sys.exit(app.exec_()) ``` 在上面的代码中,我们使用了 Python 的 docx 库来生成 Word 文档。在设置标题和正文的格式时,我们根据要求设置了不同的字体、字行距等样式。最后,通过调用 save() 方法保存 Word 文档。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值