Selection
Selection
ภาพรวม
คลาส Selection อยู่ใน Aspose.Html FOSS สำหรับ Python.
การเลือกระดับเอกสารด้วยความหมายช่วงเดียว.
คลาสนี้ให้ 12 วิธีสำหรับทำงานกับอ็อบเจกต์ Selection ในโปรแกรม Python. วิธีที่มีให้รวมถึง: __init__, add_range, collapse, collapse_to_end, collapse_to_start, contains_node, extend, get_range_at, remove_all_ranges, select_all_children, set_position, to_string. สมาชิกสาธารณะทั้งหมดสามารถเข้าถึงได้โดยแอปพลิเคชัน Python ใด ๆ หลังจากติดตั้งแพ็กเกจ Aspose.Html FOSS สำหรับ Python. คุณสมบัติ: anchor_node, anchor_offset, focus_node, focus_offset, is_collapsed, range_count.
คุณสมบัติ
| ชื่อ | ประเภท | การเข้าถึง | คำอธิบาย |
|---|---|---|---|
range_count | int | อ่าน | จำนวนช่วงในการเลือกนี้ (0 หรือ 1). |
anchor_node | `“Node | None”` | อ่าน |
anchor_offset | int | อ่าน | ออฟเซ็ต Anchor สำหรับทิศทางการเลือกปัจจุบัน. |
focus_node | `“Node | None”` | อ่าน |
focus_offset | int | อ่าน | ออฟเซ็ต Focus สำหรับทิศทางการเลือกปัจจุบัน. |
is_collapsed | bool | อ่าน | เป็นจริงเมื่อการเลือกว่างหรือช่วงฐานถูกยุบลง. |
วิธีการ
| ลายเซ็น | คำอธิบาย |
|---|---|
__init__(owner_document: "Document") | Calls init(owner_document) บนอินสแตนซ์ Selection นี้. |
get_range_at(index: int) → "Range" | คืนค่าช่วงที่เลือกที่ index. |
add_range(range_obj: "Range") | ตั้งค่าช่วงเดียวของการเลือกนี้เป็น range_obj. |
remove_all_ranges() | ล้างการเลือกปัจจุบัน. |
| `collapse(node: “Node | None”, offset: int)` |
| `set_position(node: “Node | None”, offset: int)` |
collapse_to_start() | ยุบการเลือกให้เป็นจุดขอบเริ่มต้นปัจจุบัน. |
collapse_to_end() | ยุบการเลือกให้ถึงจุดขอบสิ้นสุดปัจจุบัน. |
select_all_children(node: "Node") | เลือกลูกทั้งหมดของ node. |
extend(node: "Node", offset: int) | ย้ายโฟกัสของการเลือกไปที่ (node, offset). |
to_string() → str | คืนเนื้อหาแบบข้อความธรรมดาของช่วงที่เลือก. |
contains_node(node: "Node", allow_partial_containment: bool) → bool | Return True ถ้าการเลือกมี node. |