Microsoft® Excel-Dokumentkonvertierung über C++

Speichern Sie Microsoft® Excel-Dateien als Tabellenkalkulation, Web, Bild und Format mit festem Layout

 

Für jede Anwendung oder Lösung zum Konvertieren von Tabellenkalkulationen:C++ Excel-Bibliothek Beschleunigt Codierungs-, Automatisierungs- und Konvertierungsprozesse bei der Verarbeitung mehrerer Dateien, einschließlich XLSX, XLS, XLSM, XLSB, XLTX, XLTM, CSV, SpreadsheetML, ODS. Es ermöglicht auch die Konvertierung von Excel in 0 76193481*, XPS, HTML, MHTML, Einfach Text und beliebte Bilder wie JPG, TIFF, PNG, BMP und SVG.

Interkonvertierung von Microsoft Excel-Formaten

Für die Konvertierung zwischen Tabellenkalkulationsformaten ist lediglich das Laden der Tabellenkalkulation mit erforderlich Arbeitsmappe Klasse und speichern Sie sie erneut im erforderlichen Format mit der Speichern Methode der Arbeitsmappe Klasse.

C++ Beispielcode für die Konvertierung des Excel-Dateiformats

Aspose::Cells::Startup();

// Load the source excel format.
Workbook wkb(u"src_excel_file.xls");
// Save in required output format.
wkb.Save(u"output_excel_format.xlsx", SaveFormat::Xlsx);

Aspose::Cells::Cleanup();
 

Konvertieren Sie Excel-Formate mit Konformitätsstufeneinstellungen in PDF

C++ Excel-Automatisierung API unterstützt die Konvertierung von Arbeitsmappen in PDF sowie die Einstellung der Konformitätsstufe und des Erstellungsdatums. Entwickler können verwenden PDFSaveOptions zusammen mit Aspose::Cells::Rendering um die PDF-Konformität festzulegen. Für die Konvertierung verwenden Sie die Speichermethode API mit PdfSaveOptions als Parameter und dem angegebenen Ausgabedateipfad.

C++ Beispielcode für die Konvertierung von Excel in PDF

Aspose::Cells::Startup();

// Load the sample Excel file.
Workbook wkb(u"sample-convert-excel-to.pdf");
// Create pdf save options object.
PdfSaveOptions pdfSaveOptions;

// Set the compliance to PDF/A-1b.
pdfSaveOptions.SetCompliance(PdfCompliance::PdfA1b);

// or PdfCompliance::PdfA1a
// for normal PDF it will be PdfCompliance::None

// Save the Excel Document in PDF format
wkb.Save(u"output-converted-excel-workbook-to.pdf", pdfSaveOptions);

Aspose::Cells::Cleanup();
 

Speichern Sie Excel in Bildern

C++ Excel-Parser verfügt über die Möglichkeit, Daten in Form von Bildern zu exportieren. Jedes Arbeitsblatt kann in verschiedene Bildformate konvertiert werden, einschließlich BMP, JPEG, PNG und GIF, die von festgelegt werden Rendering::ImageOrPrintOptions . Für jedenKonvertieren Sie Excel in Bilder Wählen Sie den entsprechenden Fall aus den Links aus.

C++ Code für die Konvertierung von Excel in Bilder

Aspose::Cells::Startup();

// Load the XLSX.
Aspose::Cells::Workbook wkb(u"source-excel-file.xlsx");

// Access first worksheet.
Aspose::Cells::Worksheet wks = wkb.GetWorksheets().Get(0);

// Create image or print options object.
Aspose::Cells::Rendering::ImageOrPrintOptions imgOptions;

// Specify the image format. Below code is for JPEG
imgOptions.SetImageType(ImageType::Jpeg);

// For other images like GIF, BMP and PNG one can use ImageType::Gif, ImageType::Bmp and ImageType::Png respectively 

// Specify horizontal and vertical resolution
imgOptions.SetHorizontalResolution(200);
imgOptions.SetVerticalResolution(200);

// Render the sheet with respect to specified image or print options.
Aspose::Cells::Rendering::SheetRender sr(wks, imgOptions);

// Get page count.
int pageCount = sr.GetPageCount();

std::string sb = "";
// Render each page to jpeg image one by one.
for (int i = 0; i < pageCount; i++) {
	sb = ""; 
	sb += "ImagesOutputDirectoryPath/";
	sb += "outputConvertingWorksheetToImageJPEG_";
	sb += std::to_string(i);
	sb += ".jpeg";
	// Get the output image path.
	U16String outputJPEG(sb.c_str());
	// Convert worksheet to image.
	sr.ToImage(i, outputJPEG);
}

Aspose::Cells::Cleanup();