การใช้ Aspose.Total for .NET คุณสามารถแปลงไฟล์ CGM เป็น TXT ได้อย่างง่ายดายภายในแอปพลิเคชัน .NET, C#, ASP.NET และ VB.NET ประการแรก ด้วยการใช้ Aspose.PDF for .NET คุณสามารถส่งออก CGM ไปยัง XLSX ได้ หลังจากนั้น คุณสามารถใช้ Aspose.Cells for .NET Spreadsheet Programming API เพื่อแปลง XLSX เป็น TXT
.NET API เพื่อแปลง CGM เป็น TXT
ข้อกำหนดการแปลง
ติดตั้งจากบรรทัดคำสั่งเป็น nuget install Aspose.Total
หรือผ่าน Package Manager Console ของ Visual Studio ด้วย Install-Package Aspose.Total
หรือรับตัวติดตั้ง MSI แบบออฟไลน์หรือ DLL ในไฟล์ ZIP จาก ดาวน์โหลด
// supports PDF, CGM, EPUB, TeX, PCL, PS, SVG, XPS, MD, MHTML, XML, and XSLFO file format | |
// load PDF as input file format with an instance of Document class | |
var document = new Document("template.pdf"); | |
// save document in XLSX format | |
document.Save("excel_output.xlsx", Aspose.Pdf.SaveFormat.Xlsx); | |
// load the XLSX file in an instance of Workbook | |
var book = new Workbook("excel_output.xlsx"); | |
// supports XLSB, XLSM, XLT, XLTX, XLTM, XLAM, CSV, TSV, TXT, ODS, DIF, MD, SXC, and FODS file format | |
// save input document as CSV | |
book.Save("output.csv", Aspose.Cells.SaveFormat.Auto); |
แปลง CGM ที่ได้รับการป้องกันเป็น TXT ผ่าน C#
หากเอกสาร CGM ของคุณมีการป้องกันด้วยรหัสผ่าน คุณจะไม่สามารถแปลงเป็น TXT ได้หากไม่มีรหัสผ่าน เมื่อใช้ API คุณสามารถเปิดเอกสารที่มีการป้องกันโดยใช้รหัสผ่านที่ถูกต้องและแปลงหลังจากนั้น ในการเปิดไฟล์ที่เข้ารหัส คุณสามารถเริ่มต้นอินสแตนซ์ใหม่ของคลาส Document และส่งชื่อไฟล์และรหัสผ่านเป็นอาร์กิวเมนต์ได้
// supports PDF, CGM, EPUB, TeX, PCL, PS, SVG, XPS, MD, MHTML, XML, and XSLFO input file formats | |
// open password protected PDF document | |
Document doc = new Document("input.pdf", "Your@Password"); | |
// save document in XLSX format | |
document.Save("excel_output.xlsx", Aspose.Pdf.SaveFormat.Xlsx); | |
// load the XLSX file in an instance of Workbook | |
var book = new Workbook("excel_output.xlsx"); | |
// supports XLSB, XLSM, XLT, XLTX, XLTM, XLAM, CSV, TSV, TXT, ODS, DIF, MD, SXC, and FODS file format | |
// save input document as CSV | |
book.Save("output.csv", Aspose.Cells.SaveFormat.Auto); |
แปลงไฟล์ CGM เป็น TXT พร้อมลายน้ำผ่าน C#
ในขณะที่แปลงไฟล์ CGM เป็น TXT คุณยังสามารถเพิ่มลายน้ำให้กับรูปแบบไฟล์ TXT เอาต์พุตของคุณ ในการเพิ่มลายน้ำ คุณสามารถสร้างวัตถุสมุดงานใหม่และเปิดเอกสาร XLSX ที่แปลงแล้ว เลือกแผ่นงานผ่านดัชนี สร้างรูปร่าง และใช้ฟังก์ชัน AddTextEffect หลังจากนั้น คุณสามารถบันทึกเอกสาร XLSX ของคุณเป็น TXT ด้วยลายน้ำ
// supports PDF, CGM, EPUB, TeX, PCL, PS, SVG, XPS, MD, MHTML, XML, and XSLFO file format | |
// load PDF as input file format with an instance of Document class | |
var document = new Document("template.pdf"); | |
// save document in XLSX format | |
document.Save("excel_output.xlsx", Aspose.Pdf.SaveFormat.Xlsx); | |
// load the XLSX file in an instance of Workbook | |
var book = new Workbook("excel_output.xlsx"); | |
// get the first default sheet | |
var sheet = book.Worksheets[0]; | |
// add a new shape to ShapesCollection of Worksheet | |
var wordart = sheet.Shapes.AddTextEffect(Aspose.Cells.Drawing.MsoPresetTextEffect.TextEffect1, | |
"CONFIDENTIAL", "Arial Black", 50, false, true, 18, 8, 1, 1, 130, 800); | |
// supports XLSB, XLSM, XLT, XLTX, XLTM, XLAM, CSV, TSV, TXT, ODS, DIF, MD, SXC, and FODS file format | |
// save input document as CSV | |
book.Save("output.csv", Aspose.Cells.SaveFormat.Auto); |