Aspose.Note FOSS for Python

Tham chiếu này bao phủ toàn bộ bề mặt API công cộng của aspose-note phiên bản 26.3.1. Chỉ các ký hiệu được xuất ra từ aspose.note gói được tài liệu hoá ở đây. Bất kỳ thứ gì dưới aspose.note._internal là chi tiết triển khai và có thể thay đổi mà không thông báo.

Enumerations: pip install aspose-note (core) hoặc pip install "aspose-note[pdf]" (với xuất PDF)

Enumerations: from aspose.note import Document, RichText, ...


Enumerations

Tài liệu và Duyệt

EnumerationsEnumerations
DocumentĐối tượng tài liệu gốc. Tải một .one tệp, duyệt các trang, và lưu thành PDF.
DocumentVisitorLớp cơ sở trừu tượng cho việc duyệt theo mẫu visitor của cây tài liệu.
NodeLớp cơ sở cho tất cả các nút tài liệu.
CompositeNodeLớp cơ sở cho các nút có thể chứa các nút con.

Cấu trúc Tài liệu

EnumerationsEnumerations
PageBiểu diễn một trang OneNote.
TitleKhối tiêu đề trang chứa TitleText, TitleDate, TitleTime.
OutlineBộ chứa vị trí cho các nút OutlineElement.
OutlineElementBộ chứa lá; chứa RichText, Image, Table, AttachedFile.

Enumerations

EnumerationsEnumerations
RichTextKhối văn bản với các đoạn định dạng, thẻ và siêu liên kết.
TextRunĐoạn văn bản định dạng đơn trong RichText.
TextStyleThuộc tính định dạng cho TextRun.
ImageHình ảnh nhúng với dữ liệu thô và siêu dữ liệu.
AttachedFileTệp đính kèm nhúng với dữ liệu thô.
TableBảng với các hàng, ô và độ rộng cột.
TableRowMột hàng trong Table.
TableCellMột ô trong TableRow; chứa các nút nội dung.
NoteTagThẻ OneNote (ngôi sao, hộp kiểm, v.v.) gắn vào nút nội dung.
NumberListSiêu dữ liệu danh sách có số thứ tự trên một OutlineElement.

Enumerations

EnumerationsEnumerations
LoadOptionsCác tùy chọn để tải một .one tệp.
SaveOptionsLớp cơ sở cho các tùy chọn lưu.
PdfSaveOptionsCác tùy chọn lưu đặc thù cho PDF (biểu tượng thẻ).

Stub Tương thích

EnumerationsEnumerations
LicenseMã giả tương thích: SetLicense() không thực hiện gì trong triển khai FOSS này.
MeteredMã giả tương thích: SetMeteredKey() không thực hiện gì trong triển khai FOSS này.

Chi tiết Lớp

Enumerations

Lớp tài liệu gốc. Tải một .one tệp từ đường dẫn tệp, một pathlib.Path, hoặc một luồng nhị phân.

from aspose.note import Document, LoadOptions

doc = Document(source=None, load_options=None)

Tham số khởi tạo:

EnumerationsEnumerationsEnumerations
source`strPath
load_options`LoadOptionsNone`

Enumerations:

EnumerationsEnumerationsEnumerations
DisplayName`strNone`
CreationTime`datetimeNone`
FileFormatFileFormatChỉ báo cố gắng tốt nhất về phiên bản định dạng tệp OneNote

Enumerations:

EnumerationsEnumerationsEnumerations
Count()() -> intSố lượng trang con trực tiếp
GetPageHistory(page)(Page) -> list[Page]Enumerations [page] (đầu giả; lịch sử đầy đủ chưa được triển khai)
DetectLayoutChanges()() -> NoneĐầu giả tương thích; không thực hiện gì
Save(target, format_or_options)`(strPath
Accept(visitor)(DocumentVisitor) -> NoneGọi việc duyệt visitor
for page in docN/ALặp qua con trực tiếp Page các nút

Document.FileFormat ghi chú: Thuộc tính này cung cấp một chỉ báo nỗ lực tốt nhất về phiên bản định dạng tệp OneNote. Thuộc tính FileFormat enum có ba giá trị: OneNote2010, OneNoteOnline, và OneNote2007.

Document.Save() hỗ trợ stream: target có thể là một luồng nhị phân (io.BytesIO, tay cầm tệp được mở ở chế độ ghi nhị phân, v.v.). Điều này được xác nhận bởi bộ kiểm thử: doc.Save(io.BytesIO(), PdfSaveOptions(SaveFormat.Pdf)).


DocumentVisitor

Lớp cơ sở trừu tượng cho việc duyệt theo mẫu visitor. Ghi đè các phương thức visit mà bạn cần:

EnumerationsĐược gọi khi
VisitDocumentStart(doc)Đang vào nút Document
VisitDocumentEnd(doc)Rời khỏi nút Document
VisitPageStart(page)Đang vào nút Page
VisitPageEnd(page)Rời khỏi nút Page
VisitTitleStart(title)Đang vào nút Title
VisitTitleEnd(title)Rời khỏi nút Title
VisitOutlineStart(outline)Đang vào nút Outline
VisitOutlineEnd(outline)Rời khỏi nút Outline
VisitOutlineElementStart(oe)Đang vào nút OutlineElement
VisitOutlineElementEnd(oe)Rời khỏi nút OutlineElement
VisitRichTextStart(rt)Đang vào nút RichText
VisitRichTextEnd(rt)Rời khỏi nút RichText
VisitImageStart(img)Đang vào nút Image
VisitImageEnd(img)Rời khỏi nút Image

Enumerations

Lớp cơ sở cho tất cả các nút cây tài liệu.

Thuộc tính / Phương thứcEnumerationsEnumerations
ParentNode`NodeNone`
Document`DocumentNone`
Accept(visitor)(DocumentVisitor) -> NoneGửi visitor cho nút này

CompositeNode

Enumerations Node. Thêm quản lý con:

Thuộc tính / Phương thứcEnumerations
FirstChildNút con đầu tiên, hoặc None
LastChildNút con cuối cùng, hoặc None
AppendChildLast(node)Thêm một nút con vào cuối; sets node.ParentNode = self
AppendChildFirst(node)Thêm một nút con vào đầu
InsertChild(index, node)Chèn một nút con vào vị trí đã cho
RemoveChild(node)Xóa một nút con; sets node.ParentNode = None
GetEnumerator()Trả về một iterator trên các nút con trực tiếp
for child in nodeLặp qua các nút con trực tiếp
GetChildNodes(Type)(Type) -> list[Type]: đệ quy, tìm kiếm theo chiều sâu của toàn bộ cây con bao gồm self

Enumerations

Enumerations CompositeNode. Đại diện cho một trang OneNote.

EnumerationsEnumerationsEnumerations
Title`TitleNone`
Author`strNone`
CreationTime`datetimeNone`
LastModifiedTime`datetimeNone`
Level`intNone`

Enumerations:

EnumerationsEnumerations
Clone(deep=False)Trả về một bản sao nông hoặc sâu của trang

Enumerations

Enumerations CompositeNode. Giữ khối tiêu đề của một Page.

EnumerationsEnumerationsEnumerations
TitleText`RichTextNone`
TitleDate`RichTextNone`
TitleTime`RichTextNone`

Enumerations

Enumerations CompositeNode. Một container vị trí cho OutlineElement các nút.

EnumerationsEnumerationsEnumerations
X`floatNone`
Y`floatNone`
Width`floatNone`

OutlineElement

Enumerations CompositeNode. Một container lá chứa các nút nội dung.

EnumerationsEnumerationsEnumerations
IndentLevelintĐộ sâu lồng nhau (0 = ngoài cùng)
NumberList`NumberListNone`
Tagslist[NoteTag]Thẻ OneNote gắn vào phần tử này

RichText

Enumerations CompositeNode. Một khối văn bản có kiểu dáng.

EnumerationsEnumerationsEnumerations
TextstrChuỗi văn bản thuần đầy đủ (tất cả các đoạn được nối lại)
Runslist[TextRun]Danh sách có thứ tự của các đoạn đã định dạng
FontSize`floatNone`
Tagslist[NoteTag]Thẻ OneNote gắn vào khối này

Enumerations:

EnumerationsEnumerationsEnumerations
Append(text, style=None)`(str, TextStyleNone) -> RichText`
Replace(old_value, new_value)(str, str) -> NoneThay thế chuỗi trong bộ nhớ trên Text; không cập nhật Runs

TextRun

Enumerations Node. Một đoạn văn bản định dạng đơn.

EnumerationsEnumerationsEnumerations
TextstrNội dung văn bản của đoạn (mặc định "")
StyleTextStyleThuộc tính định dạng
Start`intNone`
End`intNone`

TextStyle

Enumerations Node. Thuộc tính định dạng theo ký tự cho một TextRun.

EnumerationsEnumerationsEnumerationsEnumerations
BoldboolFalseEnumerations
ItalicboolFalseEnumerations
UnderlineboolFalseEnumerations
StrikethroughboolFalseEnumerations
SuperscriptboolFalseEnumerations
SubscriptboolFalseEnumerations
FontName`strNone`None
FontSize`floatNone`None
FontColor`intNone`None
HighlightColor`intNone`None
LanguageId`intNone`None
IsHyperlinkboolFalseLiệu lần chạy này có phải là siêu liên kết hay không
HyperlinkAddress`strNone`None

Enumerations

Enumerations CompositeNode. Một hình ảnh được nhúng.

EnumerationsEnumerationsEnumerations
FileName`strNone`
BytesbytesDữ liệu hình ảnh thô (mặc định b"")
Width`floatNone`
Height`floatNone`
AlternativeTextTitle`strNone`
AlternativeTextDescription`strNone`
HyperlinkUrl`strNone`
Tagslist[NoteTag]Thẻ OneNote đính kèm vào hình ảnh này

Enumerations:

EnumerationsEnumerations
Replace(image)Enumerations BytesFileName từ một khác Image nút vào nút này

AttachedFile

Enumerations CompositeNode. Một tệp đính kèm nhúng.

EnumerationsEnumerationsEnumerations
FileName`strNone`
BytesbytesDữ liệu tệp thô (mặc định b"")
Tagslist[NoteTag]Thẻ OneNote đính kèm vào tệp đính kèm này

Enumerations

Enumerations CompositeNode. Một bảng trong OutlineElement.

EnumerationsEnumerationsEnumerationsEnumerations
Columnslist[float][]Chiều rộng của mỗi cột tính bằng điểm
IsBordersVisibleboolTrueCó hiển thị viền bảng hay không
Tagslist[NoteTag][]Thẻ OneNote đính kèm vào bảng này

TableRow

Enumerations CompositeNode. Một hàng trong một Table. Lặp lại GetChildNodes(TableCell) để truy cập các ô.


TableCell

Enumerations CompositeNode. Một ô trong một TableRow. Chứa RichText, Image, và các nút nội dung khác.


NoteTag

Enumerations Node. Một thẻ OneNote được gắn vào một nút nội dung.

EnumerationsEnumerationsEnumerationsEnumerations
shape`intNone`None
label`strNone`None
text_color`intNone`None
highlight_color`intNone`None
created`intNone`None
completed`intNone`None

Ghi chú thời gian: createdcompleted là các dấu thời gian nguyên thô được phân tích từ định dạng nhị phân MS-ONE, không datetime đối tượng.

Phương thức tạo:

EnumerationsEnumerations
NoteTag.CreateYellowStar()Tạo một NoteTag(shape=None, label="Yellow Star")

NumberList

Enumerations Node. Siêu dữ liệu danh sách có số hoặc dấu đầu dòng trên một OutlineElement.

EnumerationsEnumerationsEnumerationsEnumerations
Format`strNone`None
Restart`intNone`None
IsNumberedboolFalseĐúng cho danh sách có thứ tự (đánh số)

LoadOptions

EnumerationsEnumerationsEnumerationsEnumerations
DocumentPassword`strNone`None
LoadHistoryboolFalseTrường tương thích API; không được sử dụng chức năng trong v26.3.1

SaveOptions

Lớp cơ sở cho tất cả các tùy chọn lưu. Đối số vị trí bắt buộc.

EnumerationsEnumerationsEnumerations
SaveFormatSaveFormatĐịnh dạng lưu đích

PdfSaveOptions

Enumerations SaveOptions. Cấu hình xuất đặc thù cho PDF. Tạo bằng PdfSaveOptions(SaveFormat.Pdf).

EnumerationsEnumerationsEnumerationsEnumerations
PageIndexint0Trường tồn tại; không được chuyển tiếp tới bộ xuất PDF trong v26.3.1: không ảnh hưởng đến đầu ra
PageCount`intNone`None
TagIconDir`strNone`None
TagIconSize`floatNone`None
TagIconGap`floatNone`None

PageIndex / PageCount cảnh báo: Các trường này được khai báo trên PdfSaveOptions để tương thích API, nhưng Document.Save() cài đặt trong v26.3.1 không đọc hoặc chuyển tiếp chúng tới bộ xuất PDF. Tất cả các trang luôn được xuất.


Giấy phép và Định mức

Các stub tương thích được xuất để duy trì hình dạng API với Aspose.Note cho .NET. Tất cả các phương thức đều không thực hiện gì trong triển khai FOSS này.

from aspose.note import License, Metered

lic = License()
lic.SetLicense("path/to/license.lic")  # no-op

m = Metered()
m.SetMeteredKey("public_key", "private_key")  # no-op

Không cần khóa giấy phép để sử dụng bất kỳ tính năng nào của Aspose.Note FOSS cho Python.


Enumerations

Tham chiếu liệt kê đầy đủ: Enumerations

SaveFormat

EnumerationsEnumerations
SaveFormat.PdfXuất PDF: đã triển khai; yêu cầu pip install "aspose-note[pdf]"
SaveFormat.OneĐịnh dạng OneNote: chỉ khai báo; gây ra UnsupportedSaveFormatException

FileFormat

Các giá trị enum đại diện cho phiên bản định dạng tệp OneNote. Document.FileFormat cung cấp một chỉ báo nỗ lực tốt nhất.

EnumerationsGiá trị chuỗi
FileFormat.OneNote2010"onenote2010"
FileFormat.OneNoteOnline"onenoteonline"
FileFormat.OneNote2007"onenote2007"

HorizontalAlignment

EnumerationsGiá trị chuỗi
HorizontalAlignment.Left"left"
HorizontalAlignment.Center"center"
HorizontalAlignment.Right"right"

NodeType

EnumerationsGiá trị chuỗi
NodeType.Document"document"
NodeType.Page"page"
NodeType.Outline"outline"
NodeType.OutlineElement"outline_element"
NodeType.RichText"rich_text"
NodeType.Image"image"
NodeType.Table"table"
NodeType.AttachedFile"attached_file"

Enumerations

Tham chiếu đầy đủ cho ngoại lệ: Enumerations

EnumerationsEnumerations
AsposeNoteErrorLớp cơ sở cho tất cả các ngoại lệ Aspose.Note FOSS
FileCorruptedExceptionEnumerations .one tệp không thể được phân tích (bị hỏng hoặc nhị phân sai định dạng)
IncorrectDocumentStructureExceptionCấu trúc tệp không hợp lệ hoặc không được hỗ trợ
IncorrectPasswordExceptionĐược kích hoạt khi LoadOptions.DocumentPassword được đặt; tài liệu được mã hóa không được hỗ trợ
UnsupportedFileFormatExceptionĐịnh dạng tệp không được nhận dạng; tiết lộ một FileFormat trường (string)
UnsupportedSaveFormatExceptionYêu cầu SaveFormat không được triển khai trong phiên bản này

Xem Thêm

 Tiếng Việt