ดึงข้อมูลข้อความทั้งหมด
Contents
[
Hide
]วิธีการดึงข้อมูลข้อความทั้งหมด
ปัญหา: วิธีการดึงข้อมูลข้อความทั้งหมด
เคล็ดลับ: เพื่อทำเช่นนี้ คุณสามารถใช้วิธี GetStrings ซึ่งช่วยให้คุณสามารถดึงข้อมูลข้อความทั้งหมดได้
หมายเหตุ: คุณสามารถดึงข้อมูลข้อความทั้งหมดจากการวาดพื้นฐาน ด้านล่างคือตัวอย่างการดึงข้อมูลข้อความทั้งหมด แนบไฟล์ผลลัพธ์จากการแสดงผลในคอนโซล (ExtractTextResult.bmp) และไฟล์ต้นฉบับ (ExtractText.dwg)
ตัวอย่าง:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string fileName = "ExtractText"; | |
string file = string.Format("{0}.dwg", fileName); | |
using (FileStream inStream = new FileStream(file, FileMode.Open)) | |
using (CadImage image = (CadImage)Image.Load(inStream)) | |
{ | |
foreach (string s in image.GetStrings()) | |
{ | |
Console.WriteLine(s); | |
} | |
} |