Konvertieren Sie Excel in PDF, Bild und andere Formate

Konvertieren Sie die Excel-Arbeitsmappe in PDF

PDF-Dateien werden häufig zum Austausch von Dokumenten zwischen Organisationen, Regierungssektoren und Einzelpersonen verwendet. Es ist ein Standarddokumentformat und Softwareentwickler werden oft gebeten, einen Weg zu finden, Microsoft-Excel-Dateien in PDF-Dokumente umzuwandeln.

Aspose.Cells unterstützt die Konvertierung von Excel-Dateien in PDF und behält eine hohe visuelle Wiedergabetreue bei der Konvertierung bei.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Instantiate the Workbook object
// Open an Excel file
Workbook workbook = new Workbook("Book1.xlsx");
// Save the document in PDF format
workbook.Save("output.pdf");

Excel-Arbeitsmappe in JPG konvertieren

Aspose.Cells unterstützt die Konvertierung von Excel-Dateien in JPG. Das folgende Codebeispiel zeigt, wie eine Arbeitsmappe als JPG gespeichert wird.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Open a template excel file
Workbook book = new Workbook("Book1.xlsx");
//Convert workbook to JPG image.
book.Save("Image1.jpg");

Konvertieren Sie eine Excel-Arbeitsmappe in ein Bild

Aspose.Cells unterstützt die Konvertierung von Excel-Dateien in Bilder. Das folgende Codebeispiel zeigt, wie eine Arbeitsmappe als Bilder gespeichert wird.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Open a template excel file
Workbook book = new Workbook("Book1.xlsx");
//Convert workbook to BMP image.
book.Save("Image1.bmp");
//Convert workbook to JPG image.
book.Save("Image1.jpg");
//Convert workbook to Png image.
book.Save("Image1.png");
//Convert workbook to EMF image.
book.Save("Image1.emf");
//Convert workbook to GIF image.
book.Save("Image1.gif");

Konvertieren der Excel-Arbeitsmappe in XPS

Das Dokumentformat XPS besteht aus strukturiertem XML-Markup, das das Layout eines Dokuments und das visuelle Erscheinungsbild jeder Seite definiert, zusammen mit Wiedergaberegeln für das Verteilen, Archivieren, Wiedergeben, Verarbeiten und Drucken von Dokumenten.

Die Auszeichnungssprache für XPS ist eine Teilmenge von XAML, die es ermöglicht, Vektorgrafikelemente in Dokumente einzufügen, wobei XAML verwendet wird, um die Windows Presentation Foundation (WPF)-Grundelemente zu markieren. Die verwendeten Elemente werden in Form von Pfaden und anderen geometrischen Grundelementen beschrieben.

Eine XPS-Datei ist tatsächlich ein Unicode-ZIP-Archiv, das die Open Packaging Conventions verwendet und die Dateien enthält, aus denen das Dokument besteht. Dazu gehören eine XML-Markup-Datei für jede Seite, Text, eingebettete Schriftarten, Rasterbilder, 2D-Vektorgrafiken sowie die Informationen zur digitalen Rechteverwaltung. Der Inhalt einer XPS-Datei kann einfach untersucht werden, indem Sie sie in einer Anwendung öffnen, die ZIP-Dateien unterstützt.

Ab Aspose.Cells 6.0.0 wird die Konvertierung von Microsoft Excel in XPS unterstützt.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Open an Excel file
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(dataDir + "Book1.xls");
// Get the first worksheet
Aspose.Cells.Worksheet sheet = workbook.Worksheets[0];
// Apply different Image and Print options
Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
// Set the Format
options.SaveFormat = SaveFormat.Xps;
// Render the sheet with respect to specified printing options
Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, options);
// Save
sr.ToImage(0, dataDir + "out_printingxps.out.xps");
// Export the whole workbook to XPS
workbook.Save(dataDir + "out_whole_printingxps.out.xps", new XpsSaveOptions());

Konvertieren Sie Excel in Ods, Sxc und Fod (OpenOffice / LibreOffice Calc)

Aspose.Cells unterstützt die Konvertierung von Excel-Dateien in Ods-, Sxc- und Fods-Dateien. Das folgende Codebeispiel zeigt, wie man die konvertiertVorlage in Ods-, Sxc- und Fods-Datei.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Load your source workbook
Workbook workbook = new Workbook("book1.xlsx");
// Save as ods file
workbook.Save("Out.ods");
// Save as sxc file
workbook.Save("Out.sxc");
// Save as fods file
workbook.Save("Out.fods");

Konvertieren einer Excel-Arbeitsmappe in MHTML-Dateien

MHTML kombiniert normale HTML mit externen Ressourcen (also Inhalten, die normalerweise verlinkt sind, wie Bilder, Animationen, Audio usw.) in einer Datei. Sie werden für E-Mails mit der Dateierweiterung .mht verwendet.

Aspose.Cells unterstützt das Lesen und Schreiben von MHTML-Dateien.

Das folgende Codebeispiel zeigt, wie eine Arbeitsmappe als MHTML-Datei gespeichert wird.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Specify the file path
string filePath = dataDir + "Book1.xlsx";
// Specify the HTML Saving Options
HtmlSaveOptions sv = new HtmlSaveOptions(SaveFormat.MHtml);
// Instantiate a workbook and open the template XLSX file
Workbook wb = new Workbook(filePath);
// Save the MHT file
wb.Save(filePath + ".out.mht", sv);

Konvertieren der Excel-Arbeitsmappe in HTML

Aspose.Cells API bietet Unterstützung für den Export von Tabellenkalkulationen in das HTML-Format. Dazu nutzt die Aspose.Cells die**HtmlSaveOptions**-Klasse, um die Flexibilität bereitzustellen, mehrere Aspekte der Ausgabe HTML zu steuern.

Das folgende Codebeispiel zeigt, wie eine Arbeitsmappe als HTML-Datei gespeichert wird.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Specify the file path
string filePath = dataDir + "sample.xlsx";
// Load your sample excel file in a workbook object
Workbook wb = new Workbook(filePath);
// Save it in HTML format
wb.Save(dataDir + "ConvertingToHTMLFiles_out.html", SaveFormat.Html);

Festlegen der Bildeinstellungen für HTML

Ab 8.0.2 hat Aspose.Cells ausgesetzt**Bildoptionen** für die**HtmlSaveOptions**-Klasse, mit der Entwickler Bildeinstellungen festlegen können, wenn sie Tabellenkalkulationen im Format HTML speichern.

Nachfolgend finden Sie Einzelheiten zu einigen der Bildeinstellungen, die angewendet werden können.

Der folgende Code demonstriert die Verwendung**HtmlSaveOptions.ImageOptions**verschiedene Vorlieben angeben.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Specify the file path
string filePath = dataDir + "Book1.xlsx";
// Load a spreadsheet to be converted
Workbook book = new Workbook(filePath);
// Create an instance of HtmlSaveOptions
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.Html);
// Set the ImageFormat to PNG
saveOptions.ImageOptions.ImageType = Drawing.ImageType.Png;
// Set SmoothingMode to AntiAlias
saveOptions.ImageOptions.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
// Set TextRenderingHint to AntiAlias
saveOptions.ImageOptions.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
// Save spreadsheet to HTML while passing object of HtmlSaveOptions
book.Save( dataDir + "output.html", saveOptions);

Konvertieren Sie eine Excel-Arbeitsmappe in Markdown

Die Aspose.Cells API bietet Unterstützung für den Export von Tabellenkalkulationen in das Markdown-Format. Um das aktive Arbeitsblatt nach Markdown zu exportieren, pass**SaveFormat.Markdown** als zweiter Parameter von**Workbook.Speichern** Methode. Sie können auch verwenden**MarkdownSaveOptions**-Klasse, um zusätzliche Einstellungen für das Exportieren von Arbeitsblättern nach Markdown anzugeben.

Das folgende Codebeispiel veranschaulicht das Exportieren eines aktiven Arbeitsblatts nach Markdown mithilfe von**SaveFormat.Markdown** Aufzählungsmitglied. Bitte sehen Sie sich … anMarkdown-Datei ausgebengeneriert durch den Code als Referenz.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Open the template file
Workbook workbook = new Workbook(sourceDir + "Book1.xlsx");
// Save as Markdown
workbook.Save(outputDir + "Book1.md", SaveFormat.Markdown);

Konvertieren Sie die Excel-Arbeitsmappe in JSON

Aspose.Cells unterstützt die Konvertierung einer Arbeitsmappe in eine Json-Datei (JavaScript Object Notation).

Das folgende Codebeispiel veranschaulicht das Exportieren eines aktiven Arbeitsblatts in Json mithilfe vonSaveFormat.Json Aufzählungsmitglied. Bitte sehen Sie sich den Code zum Konvertieren anQuelldatei zumJson-Datei ausgebengeneriert durch den Code als Referenz.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Load your source workbook
Workbook workbook = new Workbook("Book1.xlsx");
// convert the workbook to json file.
workbook.Save(dir + "book1.json");

Konvertieren Sie Excel in XML

Aspose.Cells unterstützt die Konvertierung einer Arbeitsmappe in Excel 2003 Spreadsheet XML und einfache XML-Daten.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Load your source workbook
Workbook workbook = new Workbook("Book1.xlsx");
//Save as Excel 2003 Spreadsheet XML
workbook.Save("Spreadsheet.xml");
//Save as plain XML data
XmlSaveOptions xmlSaveOptions = new XmlSaveOptions();
workbook.Save("data.xml", xmlSaveOptions);

Konvertieren Sie die Excel-Arbeitsmappe in TIFF

Aspose.Cells unterstützt die Konvertierung einer Arbeitsmappe in eine TIFF-Datei.

Das folgende Code-Snippet zeigt, wie Sie Excel in TIFF konvertieren:

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Open a template excel file
Workbook book = new Workbook("Book1.xlsx");
//save file to tiff
book.Save("out.tiff");

Konvertieren Sie die Excel-Arbeitsmappe in DOCX

Die Aspose.Cells API bietet Unterstützung für die Konvertierung von Tabellenkalkulationen in das DOCX-Format. Um die Arbeitsmappe nach DOCX zu exportieren, passSaveFormat.Docx als zweiter Parameter vonArbeitsmappe.Speichern Methode. Sie können auch verwendenDocxSaveOptions Klasse, um zusätzliche Einstellungen für den Export von Arbeitsblättern nach DOCX anzugeben.

Das folgende Codebeispiel veranschaulicht das Exportieren eines aktiven Arbeitsblatts nach DOCX mithilfe vonSaveFormat.Docx Aufzählungsmitglied. Bitte sehen Sie sich … anAusgabedatei DOCXgeneriert durch den Code als Referenz.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Open the template file
Workbook workbook = new Workbook(sourceDir + "Book1.xlsx");
// Save as Markdown
workbook.Save(outputDir + "Book1.docx", SaveFormat.Docx);

Konvertieren Sie die Excel-Arbeitsmappe in PPTX

Die Aspose.Cells API bietet Unterstützung für die Konvertierung von Tabellenkalkulationen in das PPTX-Format. Um die Arbeitsmappe nach PPTX zu exportieren, passSaveFormat.Pptx als zweiter Parameter vonArbeitsmappe.Speichern Methode. Sie können auch verwendenPptxSaveOptions Klasse, um zusätzliche Einstellungen für den Export von Arbeitsblättern nach PPTX anzugeben.

Das folgende Codebeispiel veranschaulicht das Exportieren eines aktiven Arbeitsblatts nach PPTX mithilfe vonSaveFormat.Pptx Aufzählungsmitglied. Bitte sehen Sie sich … anAusgabedatei PPTXgeneriert durch den Code als Referenz.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Open the template file
Workbook workbook = new Workbook(sourceDir + "Book1.xlsx");
// Save as Markdown
workbook.Save(outputDir + "Book1.pptx", SaveFormat.Pptx);

Themen vorantreiben