Aspose.Total for .NET 을 사용하면 모든 .NET, C#, ASP.NET 및 VB.NET 응용 프로그램 내에서 CGM 파일을 EXCEL로 쉽게 변환할 수 있습니다. 먼저 Aspose.PDF for .NET 을 사용하여 CGM을 XLSX로 내보낼 수 있습니다. 그런 다음 Aspose.Cells for .NET Spreadsheet Programming API를 사용하여 XLSX를 EXCEL로 변환할 수 있습니다.
CGM을 EXCEL로 변환하는 .NET API
변환 요구 사항
명령줄에서 nuget install Aspose.Total
로 설치하거나 Visual Studio의 패키지 관리자 콘솔을 통해 Install-Package Aspose.Total
로 설치합니다.
또는 downloads 에서 ZIP 파일의 오프라인 MSI 설치 프로그램 또는 DLL을 가져옵니다.
// 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); |
C#을 통해 보호된 CGM을 EXCEL로 변환
CGM 문서가 비밀번호로 보호되어 있는 경우 비밀번호 없이 EXCEL로 변환할 수 없습니다. 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); |
C#을 통해 워터마크를 사용하여 CGM 파일을 EXCEL로 변환
CGM 파일을 EXCEL로 변환하는 동안 출력 EXCEL 파일 형식에 워터마크를 추가할 수도 있습니다. 워터마크를 추가하려면 새 통합 문서 개체를 만들고 변환된 XLSX 문서를 열고 해당 인덱스를 통해 워크시트를 선택하고 모양을 만들고 해당 AddTextEffect 기능을 사용할 수 있습니다. 그런 다음 워터마크를 사용하여 XLSX 문서를 EXCEL로 저장할 수 있습니다.
// 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); |