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_countintอ่านจำนวนช่วงในการเลือกนี้ (0 หรือ 1).
anchor_node`“NodeNone”`อ่าน
anchor_offsetintอ่านออฟเซ็ต Anchor สำหรับทิศทางการเลือกปัจจุบัน.
focus_node`“NodeNone”`อ่าน
focus_offsetintอ่านออฟเซ็ต Focus สำหรับทิศทางการเลือกปัจจุบัน.
is_collapsedboolอ่านเป็นจริงเมื่อการเลือกว่างหรือช่วงฐานถูกยุบลง.

วิธีการ

ลายเซ็นคำอธิบาย
__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: “NodeNone”, offset: int)`
`set_position(node: “NodeNone”, 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) → boolReturn True ถ้าการเลือกมี node.

ดูเพิ่มเติม

 ภาษาไทย