En utilisant Aspose.Total for .NET , vous pouvez facilement convertir un fichier CGM en XLAM dans n’importe quelle application .NET, C#, ASP.NET et VB.NET. Tout d’abord, en utilisant Aspose.PDF for .NET , vous pouvez exporter CGM vers XLSX. Après cela, en utilisant l’API de programmation de feuille de calcul Aspose.Cells for .NET , vous pouvez convertir XLSX en XLAM.
API .NET pour convertir CGM en XLAM
Exigences de conversion
Installez à partir de la ligne de commande en tant que nuget install Aspose.Total
ou via la console du gestionnaire de packages de Visual Studio avec Install-Package Aspose.Total
.
Vous pouvez également obtenir le programme d’installation MSI hors ligne ou les DLL dans un fichier ZIP à partir de téléchargements .
// 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); |
Convertir CGM protégé en XLAM via C#
Si votre document CGM est protégé par un mot de passe, vous ne pouvez pas le convertir en XLAM sans le mot de passe. À l’aide de l’API, vous pouvez d’abord ouvrir le document protégé à l’aide d’un mot de passe valide et le convertir ensuite. Pour ouvrir le fichier chiffré, vous pouvez initialiser une nouvelle instance de la classe Document et transmettre le nom de fichier et le mot de passe comme arguments.
// 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); |
Convertir un fichier CGM en XLAM avec filigrane via C#
Lors de la conversion du fichier CGM en XLAM, vous pouvez également ajouter un filigrane au format de votre fichier XLAM de sortie. Pour ajouter un filigrane, vous pouvez créer un nouvel objet Workbook et ouvrir le document XLSX converti, sélectionner Worksheet via son index, créer une Shape et utiliser sa fonction AddTextEffect. Après cela, vous pouvez enregistrer votre document XLSX au format XLAM avec filigrane.
// 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); |