Aspose.Note FOSS for Python
เอกสารอ้างอิงนี้ครอบคลุมพื้นผิว API สาธารณะทั้งหมดของ aspose-note เวอร์ชัน 26.3.1. มีเพียงสัญลักษณ์ที่ส่งออกจาก aspose.note แพคเกจที่ถูกบันทึกไว้ที่นี่ ทุกอย่างที่อยู่ภายใต้ aspose.note._internal เป็นรายละเอียดการทำงานและอาจเปลี่ยนแปลงโดยไม่แจ้งล่วงหน้า.
Properties: pip install aspose-note (core) หรือ pip install "aspose-note[pdf]" (พร้อมการส่งออก PDF)
Properties: from aspose.note import Document, RichText, ...
Properties
เอกสารและการสำรวจ
| Properties | Properties |
|---|---|
Document | อ็อบเจ็กต์เอกสารราก โหลด .one ไฟล์, วนลูปหน้าต่าง ๆ และบันทึกเป็น PDF. |
DocumentVisitor | ฐานเชิงนามธรรมสำหรับการเดินทางแบบ visitor-pattern ของโครงสร้างต้นไม้เอกสาร. |
Node | คลาสฐานสำหรับโหนดเอกสารทั้งหมด. |
CompositeNode | คลาสฐานสำหรับโหนดที่สามารถบรรจุโหนดลูกได้. |
โครงสร้างเอกสาร
| Properties | Properties |
|---|---|
Page | แสดงถึงหน้าของ OneNote. |
Title | บล็อกหัวเรื่องหน้าที่ประกอบด้วย TitleText, TitleDate, TitleTime. |
Outline | คอนเทนเนอร์ตำแหน่งสำหรับโหนด OutlineElement. |
OutlineElement | คอนเทนเนอร์ใบไม้; เก็บ RichText, Image, Table, AttachedFile. |
Properties
| Properties | Properties |
|---|---|
RichText | บล็อกข้อความที่มีการจัดรูปแบบ, แท็ก, และไฮเปอร์ลิงก์. |
TextRun | ส่วนข้อความที่จัดรูปแบบเดียวภายใน RichText. |
TextStyle | คุณสมบัติการจัดรูปแบบสำหรับ TextRun. |
Image | ภาพฝังที่มีไบต์ดิบและเมตาดาต้า. |
AttachedFile | ไฟล์แนบที่ฝังไว้พร้อมไบต์ดิบ. |
Table | ตารางที่มีแถว, เซลล์, และความกว้างของคอลัมน์. |
TableRow | แถวหนึ่งภายในตาราง. |
TableCell | เซลล์หนึ่งภายใน TableRow; มีโหนดเนื้อหา. |
NoteTag | แท็ก OneNote (ดาว, กล่องทำเครื่องหมาย, ฯลฯ) ที่แนบกับโหนดเนื้อหา. |
NumberList | เมตาดาต้ารายการลำดับเลขบน OutlineElement. |
Properties
| Properties | Properties |
|---|---|
LoadOptions | ตัวเลือกสำหรับการโหลด .one ไฟล์. |
SaveOptions | คลาสฐานสำหรับตัวเลือกการบันทึก. |
PdfSaveOptions | ตัวเลือกการบันทึกเฉพาะ PDF (ไอคอนแท็ก). |
ส่วนจำลองความเข้ากันได้
| Properties | Properties |
|---|---|
License | โค้ดสแตบความเข้ากันได้: SetLicense() เป็นการทำงานที่ไม่มีผลในการนำไปใช้แบบ FOSS นี้. |
Metered | โค้ดสแตบความเข้ากันได้: SetMeteredKey() เป็นการทำงานที่ไม่มีผลในการนำไปใช้แบบ FOSS นี้. |
รายละเอียดคลาส
Properties
คลาสเอกสารราก. โหลด .one ไฟล์จากเส้นทางไฟล์, a pathlib.Path, หรือสตรีมไบนารี.
from aspose.note import Document, LoadOptions
doc = Document(source=None, load_options=None)พารามิเตอร์ของคอนสตรัคเตอร์:
| Properties | Properties | Properties |
|---|---|---|
source | `str | Path |
load_options | `LoadOptions | None` |
Properties:
| Properties | Properties | Properties |
|---|---|---|
DisplayName | `str | None` |
CreationTime | `datetime | None` |
FileFormat | FileFormat | การบ่งชี้เวอร์ชันรูปแบบไฟล์ OneNote อย่างพยายามให้ดีที่สุด |
Properties:
| Properties | Properties | Properties |
|---|---|---|
Count() | () -> int | จำนวนหน้าลูกโดยตรง |
GetPageHistory(page) | (Page) -> list[Page] | Properties [page] (โครงสร้างจำลอง; ประวัติเต็มยังไม่ได้ทำการใช้งาน) |
DetectLayoutChanges() | () -> None | โครงสร้างจำลองความเข้ากันได้; ไม่มีการดำเนินการ |
Save(target, format_or_options) | `(str | Path |
Accept(visitor) | (DocumentVisitor) -> None | เรียกใช้การเดินทางของผู้เยี่ยมชม |
for page in doc | N/A | วนซ้ำลูกโดยตรง Page โหนด |
Document.FileFormat บันทึก: คุณสมบัตินี้ให้การบ่งชี้เวอร์ชันรูปแบบไฟล์ OneNote อย่างพยายามให้ดีที่สุด. The FileFormat enum มีสามค่า: OneNote2010, OneNoteOnline, และ OneNote2007.
Document.Save() การสนับสนุนสตรีม: target สามารถเป็นสตรีมไบนารี (io.BytesIO, ตัวจัดการไฟล์ที่เปิดในโหมดเขียนไบนารี, เป็นต้น). สิ่งนี้ได้รับการยืนยันโดยชุดทดสอบ: doc.Save(io.BytesIO(), PdfSaveOptions(SaveFormat.Pdf)).
DocumentVisitor
คลาสฐานแบบนามธรรมสำหรับการท่องแบบ visitor-pattern. ให้ทำการ override เมธอด visit ที่คุณต้องการ:
| Properties | ถูกเรียกเมื่อ |
|---|---|
VisitDocumentStart(doc) | กำลังเข้าสู่โหนด Document |
VisitDocumentEnd(doc) | กำลังออกจากโหนด Document |
VisitPageStart(page) | กำลังเข้าสู่โหนด Page |
VisitPageEnd(page) | กำลังออกจากโหนด Page |
VisitTitleStart(title) | กำลังเข้าสู่โหนด Title |
VisitTitleEnd(title) | กำลังออกจากโหนด Title |
VisitOutlineStart(outline) | กำลังเข้าสู่โหนด Outline |
VisitOutlineEnd(outline) | กำลังออกจากโหนด Outline |
VisitOutlineElementStart(oe) | กำลังเข้าสู่โหนด OutlineElement |
VisitOutlineElementEnd(oe) | กำลังออกจากโหนด OutlineElement |
VisitRichTextStart(rt) | กำลังเข้าสู่โหนด RichText |
VisitRichTextEnd(rt) | กำลังออกจากโหนด RichText |
VisitImageStart(img) | กำลังเข้าสู่โหนด Image |
VisitImageEnd(img) | กำลังออกจากโหนด Image |
Properties
คลาสฐานสำหรับโหนดทั้งหมดในต้นไม้เอกสาร.
| คุณสมบัติ / เมธอด | Properties | Properties |
|---|---|---|
ParentNode | `Node | None` |
Document | `Document | None` |
Accept(visitor) | (DocumentVisitor) -> None | เรียกใช้ visitor สำหรับโหนดนี้ |
CompositeNode
Properties Node. เพิ่มการจัดการโหนดลูก:
| คุณสมบัติ / วิธีการ | Properties |
|---|---|
FirstChild | โหนดลูกแรก, หรือ None |
LastChild | โหนดลูกสุดท้าย, หรือ None |
AppendChildLast(node) | เพิ่มโหนดลูกที่ตำแหน่งสุดท้าย; ตั้งค่า node.ParentNode = self |
AppendChildFirst(node) | เพิ่มโหนดลูกที่ตำแหน่งเริ่มต้น |
InsertChild(index, node) | แทรกโหนดลูกที่ตำแหน่งที่กำหนด |
RemoveChild(node) | ลบโหนดลูก; ตั้งค่า node.ParentNode = None |
GetEnumerator() | คืน iterator ที่วนซ้ำลูกโดยตรง |
for child in node | วนซ้ำลูกโดยตรง |
GetChildNodes(Type) | (Type) -> list[Type]: การค้นหาแบบเรียกซ้ำ, แบบลึกก่อนของต้นไม้ย่อยทั้งหมดรวมถึง self |
Properties
Properties CompositeNode. แสดงหน้า OneNote.
| Properties | Properties | Properties |
|---|---|---|
Title | `Title | None` |
Author | `str | None` |
CreationTime | `datetime | None` |
LastModifiedTime | `datetime | None` |
Level | `int | None` |
Properties:
| Properties | Properties |
|---|---|
Clone(deep=False) | คืนสำเนาแบบตื้นหรือแบบลึกของหน้า |
Properties
Properties CompositeNode. ถือบล็อกหัวเรื่องของ Page.
| Properties | Properties | Properties |
|---|---|---|
TitleText | `RichText | None` |
TitleDate | `RichText | None` |
TitleTime | `RichText | None` |
Properties
Properties CompositeNode. ตัวคอนเทนเนอร์ตำแหน่งสำหรับ OutlineElement โหนด.
| Properties | Properties | Properties |
|---|---|---|
X | `float | None` |
Y | `float | None` |
Width | `float | None` |
OutlineElement
Properties CompositeNode. ตัวคอนเทนเนอร์ใบที่เก็บโหนดเนื้อหา.
| Properties | Properties | Properties |
|---|---|---|
IndentLevel | int | ความลึกของการซ้อน (0 = นอกสุด) |
NumberList | `NumberList | None` |
Tags | list[NoteTag] | แท็ก OneNote ที่แนบกับองค์ประกอบนี้ |
RichText
Properties CompositeNode. บล็อกของข้อความที่มีสไตล์.
| Properties | Properties | Properties |
|---|---|---|
Text | str | สตริงข้อความธรรมดาเต็มรูปแบบ (ทุกรันต่อเนื่องกัน) |
Runs | list[TextRun] | รายการลำดับของส่วนที่จัดรูปแบบ |
FontSize | `float | None` |
Tags | list[NoteTag] | แท็ก OneNote ที่แนบกับบล็อกนี้ |
Properties:
| Properties | Properties | Properties |
|---|---|---|
Append(text, style=None) | `(str, TextStyle | None) -> RichText` |
Replace(old_value, new_value) | (str, str) -> None | การแทนที่สตริงในหน่วยความจำบน Text; ไม่อัปเดต Runs |
TextRun
Properties Node. ส่วนข้อความที่จัดรูปแบบเดียว.
| Properties | Properties | Properties |
|---|---|---|
Text | str | เนื้อหาข้อความของส่วน (ค่าเริ่มต้น "") |
Style | TextStyle | คุณสมบัติการจัดรูปแบบ |
Start | `int | None` |
End | `int | None` |
TextStyle
Properties Node. คุณสมบัติการจัดรูปแบบต่ออักขระสำหรับ TextRun.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
Bold | bool | False | Properties |
Italic | bool | False | Properties |
Underline | bool | False | Properties |
Strikethrough | bool | False | Properties |
Superscript | bool | False | Properties |
Subscript | bool | False | Properties |
FontName | `str | None` | None |
FontSize | `float | None` | None |
FontColor | `int | None` | None |
HighlightColor | `int | None` | None |
LanguageId | `int | None` | None |
IsHyperlink | bool | False | ว่าการทำงานนี้เป็นไฮเปอร์ลิงก์หรือไม่ |
HyperlinkAddress | `str | None` | None |
Properties
Properties CompositeNode. รูปภาพที่ฝังอยู่.
| Properties | Properties | Properties |
|---|---|---|
FileName | `str | None` |
Bytes | bytes | ข้อมูลภาพดิบ (ค่าเริ่มต้น b"") |
Width | `float | None` |
Height | `float | None` |
AlternativeTextTitle | `str | None` |
AlternativeTextDescription | `str | None` |
HyperlinkUrl | `str | None` |
Tags | list[NoteTag] | แท็ก OneNote ที่แนบกับภาพนี้ |
Properties:
| Properties | Properties |
|---|---|
Replace(image) | Properties Bytes และ FileName จากอีก Image โหนดเข้าสู่โหนดนี้ |
AttachedFile
Properties CompositeNode. ไฟล์แนบแบบฝัง.
| Properties | Properties | Properties |
|---|---|---|
FileName | `str | None` |
Bytes | bytes | ข้อมูลไฟล์ดิบ (ค่าเริ่มต้น b"") |
Tags | list[NoteTag] | แท็ก OneNote ที่แนบกับไฟล์แนบนี้ |
Properties
Properties CompositeNode. ตารางภายใน OutlineElement.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
Columns | list[float] | [] | ความกว้างของแต่ละคอลัมน์เป็นจุด |
IsBordersVisible | bool | True | ว่าขอบตารางมองเห็นได้หรือไม่ |
Tags | list[NoteTag] | [] | แท็ก OneNote ที่แนบกับตารางนี้ |
TableRow
Properties CompositeNode. แถวภายใน a Table. ทำซ้ำ GetChildNodes(TableCell) เพื่อเข้าถึงเซลล์.
TableCell
Properties CompositeNode. เซลล์ภายใน a TableRow. มี RichText, Image, และโหนดเนื้อหาอื่น ๆ.
NoteTag
Properties Node. แท็ก OneNote ที่แนบกับโหนดเนื้อหา.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
shape | `int | None` | None |
label | `str | None` | None |
text_color | `int | None` | None |
highlight_color | `int | None` | None |
created | `int | None` | None |
completed | `int | None` | None |
บันทึก timestamp: created และ completed เป็น timestamp จำนวนเต็มดิบที่แยกวิเคราะห์จากรูปแบบไบนารี MS-ONE, ไม่ใช่ datetime อ็อบเจกต์.
เมธอดแฟกทอรี:
| Properties | Properties |
|---|---|
NoteTag.CreateYellowStar() | สร้าง a NoteTag(shape=None, label="Yellow Star") |
NumberList
Properties Node. ข้อมูลเมตาของรายการลำดับหรือหัวข้อย่อยบน OutlineElement.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
Format | `str | None` | None |
Restart | `int | None` | None |
IsNumbered | bool | False | จริงสำหรับรายการที่จัดลำดับ (เป็นตัวเลข) |
LoadOptions
| Properties | Properties | Properties | Properties |
|---|---|---|---|
DocumentPassword | `str | None` | None |
LoadHistory | bool | False | ฟิลด์ความเข้ากันได้ของ API; ไม่ได้ใช้ในเชิงฟังก์ชันในเวอร์ชัน v26.3.1 |
SaveOptions
Base class for all save options. Required positional argument. → คลาสฐานสำหรับตัวเลือกการบันทึกทั้งหมด. ต้องการอาร์กิวเมนต์ตำแหน่ง.
| Properties | Properties | Properties |
|---|---|---|
SaveFormat | SaveFormat | รูปแบบการบันทึกเป้าหมาย |
PdfSaveOptions
Properties SaveOptions. การกำหนดค่าการส่งออกเฉพาะ PDF. สร้างด้วย PdfSaveOptions(SaveFormat.Pdf).
| Properties | Properties | Properties | Properties |
|---|---|---|---|
PageIndex | int | 0 | ฟิลด์มีอยู่; ไม่ได้ส่งต่อไปยังตัวส่งออก PDF ในเวอร์ชัน v26.3.1: ไม่มีผลต่อผลลัพธ์ |
PageCount | `int | None` | None |
TagIconDir | `str | None` | None |
TagIconSize | `float | None` | None |
TagIconGap | `float | None` | None |
PageIndex / PageCount ข้อควรระวัง: ฟิลด์เหล่านี้ถูกประกาศบน PdfSaveOptions เพื่อความเข้ากันได้กับ API, แต่ the Document.Save() การทำงานใน v26.3.1 ไม่ได้อ่านหรือส่งต่อไปยังตัวส่งออก PDF ทั้งหมด หน้าใด ๆ จะถูกส่งออกเสมอ.
License and Metered → ใบอนุญาตและการวัดตามการใช้งาน
Compatibility stubs exported for API shape compatibility with Aspose.Note for .NET. All methods are no-ops in this FOSS implementation. → สตับความเข้ากันของ API ถูกส่งออกเพื่อความเข้ากันของโครงสร้าง API กับ Aspose.Note สำหรับ .NET. เมธอดทั้งหมดเป็นการทำงานไม่มีผลในการนำไปใช้แบบ FOSS นี้.
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-opNo license key is required to use any feature of Aspose.Note FOSS for Python. → ไม่จำเป็นต้องมีคีย์ใบอนุญาตเพื่อใช้ฟีเจอร์ใด ๆ ของ Aspose.Note FOSS สำหรับ Python.
Properties
อ้างอิงการนับเต็ม: Properties
SaveFormat
| Properties | Properties |
|---|---|
SaveFormat.Pdf | การส่งออก PDF: ได้ทำการใช้งานแล้ว; ต้องการ pip install "aspose-note[pdf]" |
SaveFormat.One | รูปแบบ OneNote: ประกาศเท่านั้น; ทำให้เกิด UnsupportedSaveFormatException |
FileFormat
ค่าตัวนับที่แสดงเวอร์ชันของรูปแบบไฟล์ OneNote. Document.FileFormat ให้การบ่งชี้ด้วยความพยายามสูงสุด.
| Properties | ค่าแบบสตริง |
|---|---|
FileFormat.OneNote2010 | "onenote2010" |
FileFormat.OneNoteOnline | "onenoteonline" |
FileFormat.OneNote2007 | "onenote2007" |
HorizontalAlignment
| Properties | ค่าแบบสตริง |
|---|---|
HorizontalAlignment.Left | "left" |
HorizontalAlignment.Center | "center" |
HorizontalAlignment.Right | "right" |
NodeType
| Properties | ค่าแบบสตริง |
|---|---|
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" |
Properties
อ้างอิงข้อยกเว้นเต็ม: Properties
| Properties | Properties |
|---|---|
AsposeNoteError | คลาสฐานสำหรับข้อยกเว้น Aspose.Note FOSS ทั้งหมด |
FileCorruptedException | Properties .one ไฟล์ไม่สามารถแยกวิเคราะห์ได้ (เสียหายหรือไบนารีรูปแบบไม่ถูกต้อง) |
IncorrectDocumentStructureException | โครงสร้างไฟล์ไม่ถูกต้องหรือไม่รองรับ |
IncorrectPasswordException | เกิดขึ้นเมื่อ LoadOptions.DocumentPassword ถูกตั้งค่า; เอกสารที่เข้ารหัสไม่รองรับ |
UnsupportedFileFormatException | รูปแบบไฟล์ไม่เป็นที่รู้จัก; เปิดเผย a FileFormat ฟิลด์ (string) |
UnsupportedSaveFormatException | ที่ร้องขอ SaveFormat ยังไม่ได้ทำในเวอร์ชันนี้ |