The Aspose.Cells Plugins for .NET provide a robust toolkit designed to simplify and automate a wide range of spreadsheet-related tasks in .NET applications. From conversions and data processing to locking workbooks and generating images, these plugins bring modular and flexible solutions that help developers streamline their Aspose Excel workflows.
Introduction
The Aspose.Cells Plugins for .NET offer a powerful set of tools designed to simplify and automate various spreadsheet-related tasks in your .NET applications. These plugins enable you to perform efficient operations such as converting Excel files to PDFs or JSON, rendering images from spreadsheets, handling text formats, and securing documents.
Overview of Aspose.Cells Plugins
PDF Converter Plugin
With the Aspose.Cells PDF Converter plugin, you can effortlessly convert Excel spreadsheets to high-fidelity PDFs. This plugin allows for seamless integration into your applications and supports various customization options.
Customizing PDF Output
You can customize the PDF output using options such as scaling, print area, and margins. Here’s an example of how to use this feature:
using Aspose.Cells;
using System;
public class CustomizePdfOutputExample
{
public static void Main()
{
// Load an existing workbook
Workbook workbook = new Workbook(@"path/to/workbook.xlsx");
// Set up PDF save options with customization
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
// Set scaling factor (e.g., 0.75 for reducing size)
pdfSaveOptions.Scaling = 0.75;
// Define print area to be converted to PDF
pdfSaveOptions.PageIndex = 0;
pdfSaveOptions.PageCount = 1; // Convert only the first page
// Set margins (left, right, top, bottom) in points
pdfSaveOptions.MarginLeft = 20;
pdfSaveOptions.MarginRight = 20;
pdfSaveOptions.MarginTop = 20;
pdfSaveOptions.MarginBottom = 20;
// Save the workbook as PDF with custom options
workbook.Save(@"path/to/output.pdf", pdfSaveOptions);
Console.WriteLine("PDF conversion completed with custom settings.");
}
}
JSON Converter Plugin
The Aspose.Cells JSON Converter plugin enables conversion of Excel data to and from structured JSON, making it ideal for modern web APIs and microservices.
Converting Workbooks to JSON
You can convert entire workbooks, tables, or cell ranges into JSON. Here’s an example of how to achieve this:
// Load the workbook
Workbook workbook = new Workbook(@"path/to/workbook.xlsx");
// Convert the workbook to JSON
string json = workbook.Worksheets[0].Cells.ExportToJson();
Image Converter Plugin
With the Aspose.Cells Image Converter, you can render Excel workbooks or specific ranges into images (e.g., PNG, JPEG).
Exporting Sheets as Images
You can export sheets, charts, pivot tables, and ranges as high-quality images. Here’s an example of how to do this:
// Load the workbook
Workbook workbook = new Workbook(@"path/to/workbook.xlsx");
// Get the first worksheet
Worksheet sheet = workbook.Worksheets[0];
// Export the worksheet as a PNG image
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.ImageFormat = NetOffice.ExcelApi.Enums.XlPictureType.xlBitmap;
sheet.PageSetup.Export("output.png", options);
Text Converter Plugin
The Aspose.Cells Text Converter allows you to transform Excel data into a variety of text formats and vice versa.
Converting Excel Files to CSV
You can convert Excel files to CSV, TSV, XML, or SQL script formats. Here’s an example of how to do this:
// Load the workbook
Workbook workbook = new Workbook(@"path/to/workbook.xlsx");
// Save as CSV
workbook.Save("output.csv", SaveFormat.Csv);
Spreadsheet Locker Plugin
The Aspose.Cells Spreadsheet Locker provides robust features to protect and secure Excel documents at different levels.
Locking Workbooks via Code
You can lock entire workbooks or specific worksheets, apply password protection, and secure document structure. Here’s an example of how to do this:
// Load the workbook
Workbook workbook = new Workbook(@"path/to/workbook.xlsx");
// Protect the workbook with a password
workbook.Protect(ProtectionType.WorksheetAndWindow, "password123");
Conclusion
The Aspose.Cells Plugins for .NET are built to enhance productivity and simplify complex spreadsheet operations. For any support or further information, visit our Support Forum or consult the Aspose Cells Documentation. Explore the extensive resources available to learn how to use these plugins effectively in your .NET applications.