Để căn chỉnh theo chiều dọc văn bản trong ô bảng bằng Aspose. Trang trình bày Java cho Python. Ở đây bạn có thể xem mã ví dụ
Mã Python
pres = self.Presentation[]
\# Get the first slide
slide = pres.getSlides[].get_Item[0]
\# Define columns with widths and rows with heights
dbl_cols = [120, 120, 120, 120]
dbl_rows = [100, 100, 100, 100]
\# Add table shape to slide
tbl = slide.getShapes[].addTable[100, 50, dbl_cols, dbl_rows]
\# Add text to the merged cell
tbl.getRows[].get_Item[0].get_Item[1].getTextFrame[].setText["10"]
tbl.getRows[].get_Item[0].get_Item[2].getTextFrame[].setText["20"]
tbl.getRows[].get_Item[0].get_Item[3].getTextFrame[].setText["30"]
\# Accessing the text frame
txt_frame = tbl.getRows[].get_Item[0].get_Item[0].getTextFrame[]
\# Create the Paragraph object for text frame
para = txt_frame.getParagraphs[].get_Item[0]
\# Create Portion object for paragraph
fillType=FillType[]
color=Color[]
portion = para.getPortions[].get_Item[0]
portion.setText["Text here"]
portion.getPortionFormat[].getFillFormat[].setFillType[fillType.Solid]
portion.getPortionFormat[].getFillFormat[].getSolidFillColor[].setColor[color.BLACK]
\# Aligning the text vertically
textVerticalType=TextVerticalType[]
cell = tbl.getRows[].get_Item[0].get_Item[0]
textAnchorType=TextAnchorType[]
cell.setTextAnchorType[textAnchorType.Center]
cell.setTextVerticalType[textVerticalType.Vertical270]
\# Write the presentation as a PPTX file
save_format = self.SaveFormat
pres.save[self.dataDir + "AlignText.pptx", save_format.Pptx]
print "Aligned Text, please check the output file."
Tải xuống mã chạy
Tải xuống mã đang chạy từ bất kỳ trang web mã hóa xã hội nào được đề cập bên dưới
Chỉ định căn chỉnh theo chiều dọc của hình nổi, khung văn bản hoặc bảng nổi
Các thành viên
TênMô tảNONEĐối tượng được định vị rõ ràng, thường sử dụng thuộc tính Top của nó. TOPChỉ định rằng đối tượng sẽ ở trên cùng của cơ sở căn chỉnh dọc. TRUNG TÂMChỉ định rằng đối tượng sẽ được căn giữa đối với cơ sở căn chỉnh dọc. BOTTOMSchỉ định rằng đối tượng sẽ ở dưới cùng của cơ sở căn chỉnh dọc. INSIDESchỉ định rằng đối tượng sẽ ở bên trong cơ sở căn chỉnh ngang. OUTSIDEchỉ định rằng đối tượng sẽ nằm ngoài cơ sở căn chỉnh theo chiều dọc. INLINEKhông có tài liệu. Có vẻ là một giá trị có thể cho các đoạn và bảng nổi. MẶC ĐỊNHGiống nhưví dụ
Hướng dẫn cách chèn ảnh nổi vào giữa trang
doc = aw.Document[]
builder = aw.DocumentBuilder[doc]
# Insert a floating image that will appear behind the overlapping text and align it to the page's center.
shape = builder.insert_image[IMAGE_DIR + "Logo.jpg"]
shape.wrap_type = aw.drawing.WrapType.NONE
shape.behind_text = True
shape.relative_horizontal_position = aw.drawing.RelativeHorizontalPosition.PAGE
shape.relative_vertical_position = aw.drawing.RelativeVerticalPosition.PAGE
shape.horizontal_alignment = aw.drawing.HorizontalAlignment.CENTER
shape.vertical_alignment = aw.drawing.VerticalAlignment.CENTER
doc.save[ARTIFACTS_DIR + "Image.create_floating_page_center.docx"]
Xem thêm
Nói chung, id kiểu dáng là tên kiểu dáng đã loại bỏ dấu cách [cũng có thể là dấu gạch ngang và/hoặc dấu gạch dưới]
Vì vậy, nếu bạn sử dụng "Table Grid" thay vì "TableGrid", tôi nghĩ nó sẽ phù hợp với bạn
Nếu không, bạn có thể kiểm tra các phong cách. xml một phần của. docx bằng opc-diag để xem tên là gì. Ngoài ra, bạn có thể liệt kê các tên có nội dung như thế này
Tài liệu Word chứa văn bản được định dạng được bao bọc trong ba cấp độ đối tượng. Các đối tượng cấp thấp nhất, đối tượng đoạn văn cấp trung bình và đối tượng tài liệu cấp cao nhất. Vì vậy, chúng ta không thể làm việc với những văn bản này bằng các trình soạn thảo văn bản thông thường. Tuy nhiên, chúng ta có thể thao tác với các tài liệu từ này trong python bằng cách sử dụng mô-đun python-docx. Lệnh Pip để cài đặt mô-đun này là
pip install python-docx
Mô-đun docx Python cho phép người dùng thao tác với tài liệu bằng cách thao tác với tài liệu hiện có hoặc tạo một tài liệu trống mới và thao tác với nó. Nó là một công cụ mạnh mẽ vì nó giúp bạn thao tác với tài liệu ở phạm vi rất lớn
giãn dòng
Để đặt khoảng cách dòng giữa văn bản trong đoạn văn, chúng tôi sử dụng định dạng đoạn văn cùng với khoảng cách dòng. Nó được sử dụng để đặt khoảng cách giữa mỗi dòng trong đoạn văn
cú pháp. cho. đoạn_format. line_spacing = Chiều dài
Tham số. Chiều dài. Đó là chiều dài của khoảng trống được để lại giữa các dòng. Nó lấy chiều dài làm đầu vào. Nó có thể được xác định bằng giá trị khoảng cách tuyệt đối hoặc bằng giá trị khoảng cách tương đối của line-height. Nếu đầu vào ở dạng pt, inch hoặc cm thì nó coi chúng là giá trị tuyệt đối và nếu đầu vào ở dạng float thì nó được coi là giá trị tương đối
ví dụ 1. Đặt khoảng cách dòng với giá trị khoảng cách tuyệt đối
Python3
# Import docx NOT python-docx
import
docx
from
docx.shared
import
Inches
# Create an instance of a word document
from docx.enum.text import WD_ALIGN_PARAGRAPH0
from docx.enum.text import WD_ALIGN_PARAGRAPH1
from docx.enum.text import WD_ALIGN_PARAGRAPH2
from docx.enum.text import WD_ALIGN_PARAGRAPH3
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______5_______3_______6
from docx.enum.text import WD_ALIGN_PARAGRAPH7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH9
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______184_______1
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
7# Import docx NOT python-docx
8from docx.enum.text import WD_ALIGN_PARAGRAPH8
import
0
import
1
from docx.enum.text import WD_ALIGN_PARAGRAPH1
import
3import
4from docx.enum.text import WD_ALIGN_PARAGRAPH8
import
6
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______185_______8
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
7# Import docx NOT python-docx
8
from docx.enum.text import WD_ALIGN_PARAGRAPH8
docx
5
docx
6docx
7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
đầu ra
ví dụ 2. Đặt khoảng cách dòng với giá trị tương đối
Python3
# Import docx NOT python-docx
import
docx
# Create an instance of a word document
from docx.enum.text import WD_ALIGN_PARAGRAPH0
from docx.enum.text import WD_ALIGN_PARAGRAPH1
from docx.enum.text import WD_ALIGN_PARAGRAPH2
from docx.enum.text import WD_ALIGN_PARAGRAPH3
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______5_______3_______6
from docx.enum.text import WD_ALIGN_PARAGRAPH7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH9
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______184_______1
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
7# Import docx NOT python-docx
8from docx.enum.text import WD_ALIGN_PARAGRAPH8
import
3
import
1
from docx.enum.text import WD_ALIGN_PARAGRAPH1
import
6
import
6
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______185_______8
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
7# Import docx NOT python-docx
8
from docx.enum.text import WD_ALIGN_PARAGRAPH8
docx
5
docx
6docx
7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
đầu ra
Giãn cách đoạn văn
Để áp dụng giãn cách đoạn văn cho các đoạn văn bản trong tài liệu Word, chúng tôi sử dụng. đoạn_format cùng với. dấu cách_trước và. dấu cách_sau. Nó chỉ định khoảng trống được để lại trước và sau đoạn văn tương ứng. Nó chỉ có thể lấy giá trị dương làm đầu vào, nếu chúng ta đưa ra bất kỳ giá trị âm nào, nó sẽ báo lỗi phạm vi
Sr. KHÔNG
khoảng cách
Sự miêu tả
1
dấu cách_trước
Nó thêm khoảng trống trước đoạn văn trong tài liệu từ
2
dấu cách_sau
Nó thêm khoảng trống sau đoạn văn trong tài liệu từ
ví dụ 3. Thêm đoạn có và không có khoảng cách trong tài liệu Word
Python3
# Import docx NOT python-docx
import
docx
from
docx.shared
import
Inches
# Create an instance of a word document
from docx.enum.text import WD_ALIGN_PARAGRAPH0
from docx.enum.text import WD_ALIGN_PARAGRAPH1
from docx.enum.text import WD_ALIGN_PARAGRAPH2
from docx.enum.text import WD_ALIGN_PARAGRAPH3
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______5_______3_______6
from docx.enum.text import WD_ALIGN_PARAGRAPH7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH9
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______09
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
7from docx.enum.text import WD_ALIGN_PARAGRAPH16
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH18
from docx.enum.text import WD_ALIGN_PARAGRAPH19_______3_______1
import
3from docx.enum.text import WD_ALIGN_PARAGRAPH22
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH24
from docx.enum.text import WD_ALIGN_PARAGRAPH1
import
3from docx.enum.text import WD_ALIGN_PARAGRAPH22
from docx.enum.text import WD_ALIGN_PARAGRAPH8
import
6
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______31
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
7____3_______16
from docx.enum.text import WD_ALIGN_PARAGRAPH8
docx
5
docx
6docx
7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
đầu ra
Căn ngang
Để thiết lập căn lề ngang trong văn bản, chúng ta sẽ sử dụng. đoạn_format. phương pháp căn chỉnh. Nó được sử dụng cùng với WD_PARAGRAPH_ALIGNMENT để đặt căn chỉnh của đoạn văn. Bạn phải nhập WD_PARAGRAPH_ALIGNMENT từ docx. liệt kê. văn bản trước khi sử dụng nó
from docx.enum.text import WD_ALIGN_PARAGRAPH
cú pháp. cho. đoạn_format. căn chỉnh = WD_ALIGN_PARAGRAPH. [Căn chỉnh]
Tham số.
căn chỉnh. Nó được sử dụng để thiết lập sự liên kết. Bạn có thể đặt căn chỉnh thành bất kỳ bên trái, Trung tâm, bên phải hoặc căn chỉnh hoàn toàn
Các sắp xếp khác nhau được mô tả dưới đây
Sr. KHÔNG
Tên liên kết
Sự miêu tả
1
TRUNG TÂM
Nó đặt căn chỉnh thành Trung tâm
2
BÊN TRÁI
Nó đặt căn chỉnh sang trái
3
PHẢI
Nó đặt căn chỉnh sang phải
4
BẰNG CHỨNG
Nó thiết lập sự liên kết để biện minh
5
PHÂN PHÁT
Nó đặt các ký tự theo cách chúng lấp đầy toàn bộ chiều rộng của đoạn văn
ví dụ 1. Thêm các đoạn văn với Căn chỉnh Ngang khác nhau
Python3
# Import docx NOT python-docx
import
docx
from
from docx.enum.text import WD_ALIGN_PARAGRAPH46
import
from docx.enum.text import WD_ALIGN_PARAGRAPH48
# Create an instance of a word document
from docx.enum.text import WD_ALIGN_PARAGRAPH0
from docx.enum.text import WD_ALIGN_PARAGRAPH1
from docx.enum.text import WD_ALIGN_PARAGRAPH2
from docx.enum.text import WD_ALIGN_PARAGRAPH3
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______5_______3_______6
from docx.enum.text import WD_ALIGN_PARAGRAPH7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH59
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______61
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
7from docx.enum.text import WD_ALIGN_PARAGRAPH16
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH70
from docx.enum.text import WD_ALIGN_PARAGRAPH1
from docx.enum.text import WD_ALIGN_PARAGRAPH72
from docx.enum.text import WD_ALIGN_PARAGRAPH73
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______75
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
7from docx.enum.text import WD_ALIGN_PARAGRAPH16
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH70
from docx.enum.text import WD_ALIGN_PARAGRAPH1
from docx.enum.text import WD_ALIGN_PARAGRAPH86
from docx.enum.text import WD_ALIGN_PARAGRAPH87
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______89
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
7from docx.enum.text import WD_ALIGN_PARAGRAPH16
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH70
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
00
# Import docx NOT python-docx
01
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______184_______03_______3_______6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
7from docx.enum.text import WD_ALIGN_PARAGRAPH16
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH70
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
14
# Import docx NOT python-docx
15
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______184_______17
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
7from docx.enum.text import WD_ALIGN_PARAGRAPH16
from docx.enum.text import WD_ALIGN_PARAGRAPH8
from docx.enum.text import WD_ALIGN_PARAGRAPH70
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
28
docx
5
docx
6docx
7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
đầu ra
thụt đầu dòng
Để đặt thụt lề trong văn bản, chúng tôi sẽ sử dụng. phương pháp định dạng đoạn văn. Để áp dụng thụt lề, chúng tôi sử dụng left_indent và right_indent với. đoạn_format và đặt giá trị của vết lõm. Bạn phải chỉ định thụt đầu dòng với giá trị độ dài i. e inch, pt hoặc cm. Bạn cũng có thể đặt một giá trị âm dưới dạng thụt đầu dòng, điều này sẽ khiến đoạn văn trùng với lề theo giá trị đã chỉ định
Sr. KHÔNG
thụt đầu dòng
Sự miêu tả
1
left_indent
Nó đặt thụt lề trái cho đoạn văn trong file word
2
right_indent
Nó đặt thụt lề bên phải của đoạn văn trong tệp từ
cú pháp
- Đối với vết lõm bên trái. cho. đoạn_format. left_indent = kích thước
- Đối với vết lõm bên phải. cho. đoạn_format. right_indent = kích thước
Tham số.
kích cỡ. Đó là giá trị mà chúng tôi muốn thụt lề trên đoạn văn của mình. Nó có thể tính bằng inch, pt hoặc cm… v.v.
ví dụ 2. Đặt thụt lề trái và phải của đoạn văn
Python3
# Import docx NOT python-docx
import
docx
from
docx.shared
import
Inches
# Create an instance of a word document
from docx.enum.text import WD_ALIGN_PARAGRAPH0
from docx.enum.text import WD_ALIGN_PARAGRAPH1
from docx.enum.text import WD_ALIGN_PARAGRAPH2
from docx.enum.text import WD_ALIGN_PARAGRAPH3
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______5_______3_______6
from docx.enum.text import WD_ALIGN_PARAGRAPH7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
50
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______184_______52____3_______6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
58# Import docx NOT python-docx
59 # Import docx NOT python-docx
60# Import docx NOT python-docx
61 # Import docx NOT python-docx
62# Import docx NOT python-docx
63 # Import docx NOT python-docx
64# Import docx NOT python-docx
65# Import docx NOT python-docx
66
# Import docx NOT python-docx
67# Import docx NOT python-docx
63 # Import docx NOT python-docx
69
# Import docx NOT python-docx
70_______3_______1 import
3import
4
from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
75
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______184_______77
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
58# Import docx NOT python-docx
59 # Import docx NOT python-docx
85# Import docx NOT python-docx
61 # Import docx NOT python-docx
62# Import docx NOT python-docx
63 # Import docx NOT python-docx
64# Import docx NOT python-docx
65# Import docx NOT python-docx
91
# Import docx NOT python-docx
67# Import docx NOT python-docx
63 # Import docx NOT python-docx
69
# Import docx NOT python-docx
95
from docx.enum.text import WD_ALIGN_PARAGRAPH1
import
3import
4from docx.enum.text import WD_ALIGN_PARAGRAPH8
docx
5
docx
6docx
7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
đầu ra
ví dụ 3. Đặt giá trị âm cho thụt lề trái và phải của đoạn văn
Python3
# Import docx NOT python-docx
import
docx
from
docx.shared
import
Inches
# Create an instance of a word document
from docx.enum.text import WD_ALIGN_PARAGRAPH0
from docx.enum.text import WD_ALIGN_PARAGRAPH1
from docx.enum.text import WD_ALIGN_PARAGRAPH2
from docx.enum.text import WD_ALIGN_PARAGRAPH3
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______3_______5_______3_______6
from docx.enum.text import WD_ALIGN_PARAGRAPH7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
import
21
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______184_______52____3_______6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
58# Import docx NOT python-docx
59 # Import docx NOT python-docx
60# Import docx NOT python-docx
61 # Import docx NOT python-docx
62# Import docx NOT python-docx
63 # Import docx NOT python-docx
64# Import docx NOT python-docx
65# Import docx NOT python-docx
91
# Import docx NOT python-docx
67# Import docx NOT python-docx
63 # Import docx NOT python-docx
69
# Import docx NOT python-docx
70_______3_______1 import
3_______184_______65import
4
from docx.enum.text import WD_ALIGN_PARAGRAPH8
import
47
from docx.enum.text import WD_ALIGN_PARAGRAPH4_______184_______77
from docx.enum.text import WD_ALIGN_PARAGRAPH6
# Import docx NOT python-docx
3from docx.enum.text import WD_ALIGN_PARAGRAPH8
# Import docx NOT python-docx
5
from docx.enum.text import WD_ALIGN_PARAGRAPH1
# Import docx NOT python-docx
58# Import docx NOT python-docx
59 # Import docx NOT python-docx
85# Import docx NOT python-docx
61 # Import docx NOT python-docx
62# Import docx NOT python-docx
63 # Import docx NOT python-docx
64# Import docx NOT python-docx
65# Import docx NOT python-docx
91
# Import docx NOT python-docx
67# Import docx NOT python-docx
63 # Import docx NOT python-docx
69
# Import docx NOT python-docx
95
from docx.enum.text import WD_ALIGN_PARAGRAPH1
import
3_______184_______65import
4from docx.enum.text import WD_ALIGN_PARAGRAPH8
docx
5
docx
6docx
7
from docx.enum.text import WD_ALIGN_PARAGRAPH8
đầu ra
Bạn cũng có thể chỉ đặt thụt đầu dòng cho dòng đầu tiên của đoạn văn bằng cách sử dụng. đoạn_format cùng với. thuộc tính first_line_indent. Nó chỉ định độ dài thụt đầu dòng giữa dòng đầu tiên và các dòng khác
cú pháp. cho. đoạn_format. first_line_indent = Độ dài
Thông số.
Chiều dài. Đó là độ dài được để lại dưới dạng thụt đầu dòng ở dòng đầu tiên. Giá trị dương sẽ làm cho dòng thụt lề trong khi giá trị âm sẽ gây ra thụt đầu dòng
Thẻ nào được sử dụng để căn chỉnh theo chiều dọc?
Thuộc tính HTMLvalign được sử dụng để chỉ định căn chỉnh theo chiều dọc của nội dung văn bản trong một ô. Giá trị thuộc tính. đứng đầu. Nó đặt nội dung thành căn chỉnh hàng đầu. Căn lề dọc mặc định trong Word là gì?
Cài đặt mặc định trong Microsoft Word sẽ căn trái văn bản của bạn, nhưng có nhiều cách khác để định dạng căn chỉnh của tài liệu.Đó là ba tùy chọn căn chỉnh theo chiều dọc?
Căn chỉnh văn bản trong ô .Chọn các ô có văn bản bạn muốn căn chỉnhTrên tab Trang đầu, chọn một trong các tùy chọn căn chỉnh sauĐể căn chỉnh văn bản theo chiều dọc, chọn Căn trên , Căn giữa hoặc Căn dướiĐể căn chỉnh văn bản theo chiều ngang, chọn Align Text Left , Center hoặc Align Text RightCăn lề dọc trong Word là gì?
Trong phần Trang, chọn mũi tên thả xuống Căn dọc và chọn Trên cùng, Giữa, Căn đều hoặc Dưới cùng. Nếu bạn chọn Căn đều, văn bản được trải đều từ trên xuống dưới . Chọn OK. Bây giờ văn bản của bạn sẽ được căn chỉnh theo cách bạn đã chọn.Chủ Đề