---
title: "Tùy chọn và giao diện Tài liệu Word"
---


Đôi khi, bạn có thể cần thay đổi giao diện của tài liệu, chẳng hạn như đặt tùy chọn ngôn ngữ hoặc số dòng trên mỗi trang. Aspose.Words cung cấp khả năng kiểm soát cách hiển thị tài liệu cũng như một số tùy chọn bổ sung. Bài viết này mô tả những khả năng như vậy.

## Đặt tùy chọn hiển thị tài liệu

Bạn có thể kiểm soát cách hiển thị tài liệu trong Microsoft Word bằng lớp [ViewOptions](https://reference.aspose.com/words/python-net/aspose.words.settings/viewoptions/). Ví dụ: bạn có thể đặt giá trị thu phóng tài liệu bằng thuộc tính [zoom_percent](https://reference.aspose.com/words/python-net/aspose.words.settings/viewoptions/zoom_percent/) hoặc chế độ xem bằng thuộc tính [view_type](https://reference.aspose.com/words/python-net/aspose.words.settings/viewoptions/view_type/).

Ví dụ về mã sau đây cho biết cách đảm bảo rằng tài liệu được hiển thị ở mức 50% khi mở trong Microsoft Word:

{{< gist "aspose-words-gists" "e9d8f984dac599756ccb4a64b8c79768" "Examples-DocsExamples-DocsExamples-Programming with Documents-Working with Document-working_with_document_options_and_settings-SetViewOption.py" >}}

{{% alert color="primary" %}}

Bạn có thể tải xuống tệp mẫu cho ví dụ này từ [Aspose.Words GitHub](https://github.com/aspose-words/Aspose.Words-for-Python-via-.NET/blob/master/Examples/Data/Document.docx).

{{% /alert %}}

{{% alert color="primary" %}}

Microsoft Word 2013 không ghi bất kỳ hệ số thu phóng nào vào tài liệu và không còn đặt mức thu phóng mặc định từ giá trị được ghi vào tài liệu, thay vào đó, nó dường như sử dụng hệ số thu phóng của tài liệu mở cuối cùng.

{{% /alert %}}

## Đặt tùy chọn hiển thị trang

Nếu bạn muốn đặt số ký tự trên mỗi dòng, hãy sử dụng thuộc tính [characters_per_line](https://reference.aspose.com/words/python-net/aspose.words/pagesetup/characters_per_line/). Bạn cũng có thể đặt số dòng trên mỗi trang cho tài liệu Word - sử dụng thuộc tính [lines_per_page](https://reference.aspose.com/words/python-net/aspose.words/pagesetup/lines_per_page/) để nhận hoặc đặt số dòng trên mỗi trang trong lưới tài liệu.

{{% alert color="primary" %}}

Trong Microsoft Word, bạn chỉ có thể đặt các tham số tương tự bằng cách sử dụng tab "Lưới tài liệu" trong hộp thoại "Thiết lập trang" khi cài đặt hỗ trợ ngôn ngữ Châu Á.

{{% /alert %}}

Ví dụ về mã sau đây cho biết cách đặt số ký tự trên mỗi dòng và số dòng trên mỗi trang cho tài liệu Microsoft Word:

{{< gist "aspose-words-gists" "e9d8f984dac599756ccb4a64b8c79768" "Examples-DocsExamples-DocsExamples-Programming with Documents-Working with Document-working_with_document_options_and_settings-DocumentPageSetup.py" >}}

## Đặt tùy chọn ngôn ngữ

Hiển thị tài liệu trong Microsoft Word tùy thuộc vào ngôn ngữ nào được đặt làm mặc định cho tài liệu này. Nếu không có ngôn ngữ nào được đặt ở chế độ mặc định, Microsoft Word sẽ lấy thông tin từ hộp thoại "Đặt tùy chọn ngôn ngữ văn phòng", ví dụ: bạn có thể tìm thấy hộp thoại này trong "Tệp → Tùy chọn → Ngôn ngữ" trong Microsoft Word 2019.

Với Aspose.Words, bạn cũng có thể thiết lập tùy chọn ngôn ngữ bằng lớp [LanguagePreferences](https://reference.aspose.com/words/python-net/aspose.words.loading/languagepreferences/). Cũng lưu ý rằng để hiển thị chính xác tài liệu của bạn, cần phải đặt phiên bản Microsoft Word phù hợp với quá trình tải tài liệu - điều này có thể được thực hiện bằng cách sử dụng thuộc tính [msw_version](https://reference.aspose.com/words/python-net/aspose.words.loading/loadoptions/msw_version/).

{{% alert color="primary" %}}

Nếu tài liệu được tạo Aspose.Words của bạn trông không như mong đợi, hãy kiểm tra các giá trị [language_preferences](https://reference.aspose.com/words/python-net/aspose.words.loading/loadoptions/language_preferences/) và [msw_version](https://reference.aspose.com/words/python-net/aspose.words.loading/loadoptions/msw_version/) rồi điều chỉnh chúng nếu cần để khớp với cài đặt cho phiên bản Microsoft Word của bạn.

{{% /alert %}}

Ví dụ mã sau đây cho thấy cách thêm tiếng Nhật vào ngôn ngữ chỉnh sửa:

{{< gist "aspose-words-gists" "e9d8f984dac599756ccb4a64b8c79768" "Examples-DocsExamples-DocsExamples-Programming with Documents-Working with Document-working_with_document_options_and_settings-AddJapaneseAsEditinglanguages.py" >}}

Ví dụ mã sau đây cho thấy cách đặt tiếng Nga làm ngôn ngữ chỉnh sửa mặc định:

{{< gist "aspose-words-gists" "e9d8f984dac599756ccb4a64b8c79768" "Examples-DocsExamples-DocsExamples-Programming with Documents-Working with Document-working_with_document_options_and_settings-SetRussianAsDefaultEditingLanguage.py" >}}

## Tối ưu hóa tài liệu cho một phiên bản Word cụ thể

Phương pháp [optimize_for](https://reference.aspose.com/words/python-net/aspose.words.settings/compatibilityoptions/optimize_for/) cho phép tối ưu hóa nội dung tài liệu cũng như hành vi Aspose.Words mặc định cho một phiên bản Microsoft Word cụ thể. Bạn có thể sử dụng phương pháp này để ngăn Microsoft Word hiển thị dải băng "Chế độ tương thích" khi tải tài liệu. Lưu ý rằng bạn cũng có thể cần đặt thuộc tính [compliance](https://reference.aspose.com/words/python-net/aspose.words/document/compliance/) thành [ISO29500_2008_TRANSITIONAL](https://reference.aspose.com/words/python-net/aspose.words.saving/ooxmlcompliance/#iso29500_2008_transitional) hoặc cao hơn.

Ví dụ mã sau đây cho thấy cách tối ưu hóa nội dung tài liệu cho Microsoft Word 2016:

{{< gist "aspose-words-gists" "e9d8f984dac599756ccb4a64b8c79768" "Examples-DocsExamples-DocsExamples-Programming with Documents-Working with Document-working_with_document_options_and_settings-OptimizeForMsWord.py" >}}
