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

เอกสารและการสำรวจ

PropertiesProperties
Documentอ็อบเจ็กต์เอกสารราก โหลด .one ไฟล์, วนลูปหน้าต่าง ๆ และบันทึกเป็น PDF.
DocumentVisitorฐานเชิงนามธรรมสำหรับการเดินทางแบบ visitor-pattern ของโครงสร้างต้นไม้เอกสาร.
Nodeคลาสฐานสำหรับโหนดเอกสารทั้งหมด.
CompositeNodeคลาสฐานสำหรับโหนดที่สามารถบรรจุโหนดลูกได้.

โครงสร้างเอกสาร

PropertiesProperties
Pageแสดงถึงหน้าของ OneNote.
Titleบล็อกหัวเรื่องหน้าที่ประกอบด้วย TitleText, TitleDate, TitleTime.
Outlineคอนเทนเนอร์ตำแหน่งสำหรับโหนด OutlineElement.
OutlineElementคอนเทนเนอร์ใบไม้; เก็บ RichText, Image, Table, AttachedFile.

Properties

PropertiesProperties
RichTextบล็อกข้อความที่มีการจัดรูปแบบ, แท็ก, และไฮเปอร์ลิงก์.
TextRunส่วนข้อความที่จัดรูปแบบเดียวภายใน RichText.
TextStyleคุณสมบัติการจัดรูปแบบสำหรับ TextRun.
Imageภาพฝังที่มีไบต์ดิบและเมตาดาต้า.
AttachedFileไฟล์แนบที่ฝังไว้พร้อมไบต์ดิบ.
Tableตารางที่มีแถว, เซลล์, และความกว้างของคอลัมน์.
TableRowแถวหนึ่งภายในตาราง.
TableCellเซลล์หนึ่งภายใน TableRow; มีโหนดเนื้อหา.
NoteTagแท็ก OneNote (ดาว, กล่องทำเครื่องหมาย, ฯลฯ) ที่แนบกับโหนดเนื้อหา.
NumberListเมตาดาต้ารายการลำดับเลขบน OutlineElement.

Properties

PropertiesProperties
LoadOptionsตัวเลือกสำหรับการโหลด .one ไฟล์.
SaveOptionsคลาสฐานสำหรับตัวเลือกการบันทึก.
PdfSaveOptionsตัวเลือกการบันทึกเฉพาะ PDF (ไอคอนแท็ก).

ส่วนจำลองความเข้ากันได้

PropertiesProperties
Licenseโค้ดสแตบความเข้ากันได้: SetLicense() เป็นการทำงานที่ไม่มีผลในการนำไปใช้แบบ FOSS นี้.
Meteredโค้ดสแตบความเข้ากันได้: SetMeteredKey() เป็นการทำงานที่ไม่มีผลในการนำไปใช้แบบ FOSS นี้.

รายละเอียดคลาส

Properties

คลาสเอกสารราก. โหลด .one ไฟล์จากเส้นทางไฟล์, a pathlib.Path, หรือสตรีมไบนารี.

from aspose.note import Document, LoadOptions

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

พารามิเตอร์ของคอนสตรัคเตอร์:

PropertiesPropertiesProperties
source`strPath
load_options`LoadOptionsNone`

Properties:

PropertiesPropertiesProperties
DisplayName`strNone`
CreationTime`datetimeNone`
FileFormatFileFormatการบ่งชี้เวอร์ชันรูปแบบไฟล์ OneNote อย่างพยายามให้ดีที่สุด

Properties:

PropertiesPropertiesProperties
Count()() -> intจำนวนหน้าลูกโดยตรง
GetPageHistory(page)(Page) -> list[Page]Properties [page] (โครงสร้างจำลอง; ประวัติเต็มยังไม่ได้ทำการใช้งาน)
DetectLayoutChanges()() -> Noneโครงสร้างจำลองความเข้ากันได้; ไม่มีการดำเนินการ
Save(target, format_or_options)`(strPath
Accept(visitor)(DocumentVisitor) -> Noneเรียกใช้การเดินทางของผู้เยี่ยมชม
for page in docN/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

คลาสฐานสำหรับโหนดทั้งหมดในต้นไม้เอกสาร.

คุณสมบัติ / เมธอดPropertiesProperties
ParentNode`NodeNone`
Document`DocumentNone`
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.

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

Properties:

PropertiesProperties
Clone(deep=False)คืนสำเนาแบบตื้นหรือแบบลึกของหน้า

Properties

Properties CompositeNode. ถือบล็อกหัวเรื่องของ Page.

PropertiesPropertiesProperties
TitleText`RichTextNone`
TitleDate`RichTextNone`
TitleTime`RichTextNone`

Properties

Properties CompositeNode. ตัวคอนเทนเนอร์ตำแหน่งสำหรับ OutlineElement โหนด.

PropertiesPropertiesProperties
X`floatNone`
Y`floatNone`
Width`floatNone`

OutlineElement

Properties CompositeNode. ตัวคอนเทนเนอร์ใบที่เก็บโหนดเนื้อหา.

PropertiesPropertiesProperties
IndentLevelintความลึกของการซ้อน (0 = นอกสุด)
NumberList`NumberListNone`
Tagslist[NoteTag]แท็ก OneNote ที่แนบกับองค์ประกอบนี้

RichText

Properties CompositeNode. บล็อกของข้อความที่มีสไตล์.

PropertiesPropertiesProperties
Textstrสตริงข้อความธรรมดาเต็มรูปแบบ (ทุกรันต่อเนื่องกัน)
Runslist[TextRun]รายการลำดับของส่วนที่จัดรูปแบบ
FontSize`floatNone`
Tagslist[NoteTag]แท็ก OneNote ที่แนบกับบล็อกนี้

Properties:

PropertiesPropertiesProperties
Append(text, style=None)`(str, TextStyleNone) -> RichText`
Replace(old_value, new_value)(str, str) -> Noneการแทนที่สตริงในหน่วยความจำบน Text; ไม่อัปเดต Runs

TextRun

Properties Node. ส่วนข้อความที่จัดรูปแบบเดียว.

PropertiesPropertiesProperties
Textstrเนื้อหาข้อความของส่วน (ค่าเริ่มต้น "")
StyleTextStyleคุณสมบัติการจัดรูปแบบ
Start`intNone`
End`intNone`

TextStyle

Properties Node. คุณสมบัติการจัดรูปแบบต่ออักขระสำหรับ TextRun.

PropertiesPropertiesPropertiesProperties
BoldboolFalseProperties
ItalicboolFalseProperties
UnderlineboolFalseProperties
StrikethroughboolFalseProperties
SuperscriptboolFalseProperties
SubscriptboolFalseProperties
FontName`strNone`None
FontSize`floatNone`None
FontColor`intNone`None
HighlightColor`intNone`None
LanguageId`intNone`None
IsHyperlinkboolFalseว่าการทำงานนี้เป็นไฮเปอร์ลิงก์หรือไม่
HyperlinkAddress`strNone`None

Properties

Properties CompositeNode. รูปภาพที่ฝังอยู่.

PropertiesPropertiesProperties
FileName`strNone`
Bytesbytesข้อมูลภาพดิบ (ค่าเริ่มต้น b"")
Width`floatNone`
Height`floatNone`
AlternativeTextTitle`strNone`
AlternativeTextDescription`strNone`
HyperlinkUrl`strNone`
Tagslist[NoteTag]แท็ก OneNote ที่แนบกับภาพนี้

Properties:

PropertiesProperties
Replace(image)Properties Bytes และ FileName จากอีก Image โหนดเข้าสู่โหนดนี้

AttachedFile

Properties CompositeNode. ไฟล์แนบแบบฝัง.

PropertiesPropertiesProperties
FileName`strNone`
Bytesbytesข้อมูลไฟล์ดิบ (ค่าเริ่มต้น b"")
Tagslist[NoteTag]แท็ก OneNote ที่แนบกับไฟล์แนบนี้

Properties

Properties CompositeNode. ตารางภายใน OutlineElement.

PropertiesPropertiesPropertiesProperties
Columnslist[float][]ความกว้างของแต่ละคอลัมน์เป็นจุด
IsBordersVisibleboolTrueว่าขอบตารางมองเห็นได้หรือไม่
Tagslist[NoteTag][]แท็ก OneNote ที่แนบกับตารางนี้

TableRow

Properties CompositeNode. แถวภายใน a Table. ทำซ้ำ GetChildNodes(TableCell) เพื่อเข้าถึงเซลล์.


TableCell

Properties CompositeNode. เซลล์ภายใน a TableRow. มี RichText, Image, และโหนดเนื้อหาอื่น ๆ.


NoteTag

Properties Node. แท็ก OneNote ที่แนบกับโหนดเนื้อหา.

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

บันทึก timestamp: created และ completed เป็น timestamp จำนวนเต็มดิบที่แยกวิเคราะห์จากรูปแบบไบนารี MS-ONE, ไม่ใช่ datetime อ็อบเจกต์.

เมธอดแฟกทอรี:

PropertiesProperties
NoteTag.CreateYellowStar()สร้าง a NoteTag(shape=None, label="Yellow Star")

NumberList

Properties Node. ข้อมูลเมตาของรายการลำดับหรือหัวข้อย่อยบน OutlineElement.

PropertiesPropertiesPropertiesProperties
Format`strNone`None
Restart`intNone`None
IsNumberedboolFalseจริงสำหรับรายการที่จัดลำดับ (เป็นตัวเลข)

LoadOptions

PropertiesPropertiesPropertiesProperties
DocumentPassword`strNone`None
LoadHistoryboolFalseฟิลด์ความเข้ากันได้ของ API; ไม่ได้ใช้ในเชิงฟังก์ชันในเวอร์ชัน v26.3.1

SaveOptions

Base class for all save options. Required positional argument. → คลาสฐานสำหรับตัวเลือกการบันทึกทั้งหมด. ต้องการอาร์กิวเมนต์ตำแหน่ง.

PropertiesPropertiesProperties
SaveFormatSaveFormatรูปแบบการบันทึกเป้าหมาย

PdfSaveOptions

Properties SaveOptions. การกำหนดค่าการส่งออกเฉพาะ PDF. สร้างด้วย PdfSaveOptions(SaveFormat.Pdf).

PropertiesPropertiesPropertiesProperties
PageIndexint0ฟิลด์มีอยู่; ไม่ได้ส่งต่อไปยังตัวส่งออก PDF ในเวอร์ชัน v26.3.1: ไม่มีผลต่อผลลัพธ์
PageCount`intNone`None
TagIconDir`strNone`None
TagIconSize`floatNone`None
TagIconGap`floatNone`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-op

No license key is required to use any feature of Aspose.Note FOSS for Python. → ไม่จำเป็นต้องมีคีย์ใบอนุญาตเพื่อใช้ฟีเจอร์ใด ๆ ของ Aspose.Note FOSS สำหรับ Python.


Properties

อ้างอิงการนับเต็ม: Properties

SaveFormat

PropertiesProperties
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

PropertiesProperties
AsposeNoteErrorคลาสฐานสำหรับข้อยกเว้น Aspose.Note FOSS ทั้งหมด
FileCorruptedExceptionProperties .one ไฟล์ไม่สามารถแยกวิเคราะห์ได้ (เสียหายหรือไบนารีรูปแบบไม่ถูกต้อง)
IncorrectDocumentStructureExceptionโครงสร้างไฟล์ไม่ถูกต้องหรือไม่รองรับ
IncorrectPasswordExceptionเกิดขึ้นเมื่อ LoadOptions.DocumentPassword ถูกตั้งค่า; เอกสารที่เข้ารหัสไม่รองรับ
UnsupportedFileFormatExceptionรูปแบบไฟล์ไม่เป็นที่รู้จัก; เปิดเผย a FileFormat ฟิลด์ (string)
UnsupportedSaveFormatExceptionที่ร้องขอ SaveFormat ยังไม่ได้ทำในเวอร์ชันนี้

ดูเพิ่มเติม

 ภาษาไทย