ค้นหาคุณสมบัติของฟิลด์

Contents
[ ]

ฟิลด์ที่ถูกแทรกโดยใช้DocumentBuilderInsertFieldส่งกลับวัตถุField นี้เป็นชั้นซุ้มที่ให้วิธีการที่มีประโยชน์ได้อย่างรวดเร็วพบคุณสมบัติบางอย่างของเขตข้อมูล.

ตัวอย่างรหัสต่อไปนี้แสดงวิธีการค้นหารหัสฟิลด์และผลลัพธ์ฟิลด์:

//For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C
auto doc = MakeObject<Document>(MyDir + "Hyperlinks.docx");
for(const auto& field : doc->get_Range()->get_Fields())
{
auto fieldCode = field->GetFieldCode();
auto fieldResult = field->get_Result();
}

หมายเหตุถ้าคุณกำลังมองหาเฉพาะชื่อของฟิลด์ผสานในเอกสารแล้วคุณสามารถใช้วิธีการGetFieldNames.

ตัวอย่างรหัสต่อไปนี้แสดงวิธีการรับชื่อของเขตข้อมูลทั้งหมดผสานในเอกสาร:

//For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C
auto doc = MakeObject<Document>();
ArrayPtr<String> fieldNames = doc->get_MailMerge()->GetFieldNames();