Aspose.Cells Image Converter pentru .NET Plugin este un instrument puternic care permite dezvoltatorilor să convertească conținutul Excel în formate de imagine de înaltă calitate, cum ar fi PNG, JPEG, BMP și multe altele.

Introducere

Aspose.Cells Image Converter pentru .NET Plugin este conceput pentru a transforma conținutul Excel în imagini de înaltă calitate potrivite pentru rapoarte, documentație sau aplicații web. cu acest plugin, puteți converti întregi cărți de lucru, tablouri individuale, rânduri de celule și diagrame încorporate în formate de imagine, cum ar fi PNG sau JPEG cu precizie pixel-perfect.

Începeți cu Aspose.Cells Image Converter

Instalarea Aspose.Cells pentru .NET

Pentru a începe să utilizați Aspose.Cells Image Converter, mai întâi instalați biblioteca prin NuGet:

dotnet add package Aspose.Cells

Încărcați un Excel Workbook

Încărcați cartea de lucru Excel într-o Workbook Obiectivul de a începe să lucreze cu conținutul.

using Aspose.Cells;

public class ExcelLoader
{
    public static Workbook Load(string filePath)
    {
        // Load an existing Excel workbook from a file path
        return new Workbook(filePath);
    }
}

Render un tablou de lucru la PNG

Convertați prima etichetă de lucru a caricărilor încărcate într-o imagine PNG folosind următorul scan de cod:

Worksheet sheet = workbook.Worksheets[0];
ImageOrPrintOptions options = new ImageOrPrintOptions { ImageType = ImageType.Png, OnePagePerSheet = true, Resolution = 200 };
SheetRender renderer = new SheetRender(sheet, options);
for (int i = 0; i < renderer.PageCount; i++)
{
    renderer.ToImage(i, $"sheet_page_{i + 1}.png");
}

Cumpărați o întreagă carte de lucru

Pentru a transforma întreaga carte de lucru într-un singur fișier de imagine, utilizați WorkbookRender Clasă după cum se arată mai jos:

ImageOrPrintOptions options = new ImageOrPrintOptions { ImageType = ImageType.Jpeg };
WorkbookRender render = new WorkbookRender(workbook, options);
render.ToImage(0, "workbook_render.jpg");

Scenariile populare

Convertarea graficelor Excel în imagini

Convertați un grafic încorporat dintr-un panou de lucru într-o imagine PNG independentă:

Workbook wb = new Workbook("ChartSheet.xlsx");
Worksheet chartSheet = wb.Worksheets[0];
ImageOrPrintOptions chartOptions = new ImageOrPrintOptions { ImageType = ImageType.Png };
SheetRender chartRender = new SheetRender(chartSheet, chartOptions);
chartRender.ToImage(0, "chart.png");

Convertați o gamă de celule într-o imagine

Exportați o anumită gamă de celule din hârtia de lucru într-o imagine:

Workbook wb = new Workbook("Data.xlsx");
Range range = wb.Worksheets[0].Cells.CreateRange("A1:C10");
ImageOrPrintOptions rangeOptions = new ImageOrPrintOptions { ImageType = ImageType.Png };
SheetRender rangeRender = new SheetRender(wb.Worksheets[0], rangeOptions);
rangeRender.ToImage(0, "range_output.png");

Render o masă pivot ca o imagine

Convertați o tabelă pivot din hârtia de lucru într-o imagine:

Workbook wb = new Workbook("PivotData.xlsx");
ImageOrPrintOptions options = new ImageOrPrintOptions { ImageType = ImageType.Png };
SheetRender pivotRender = new SheetRender(wb.Worksheets[0], options);
pivotRender.ToImage(0, "pivot_table.png");

concluziile

Aspose.Cells Image Converter pentru .NET Plugin oferă o soluție cuprinzătoare pentru convertirea conținutului Excel în imagini de înaltă calitate. cu setul său extins de caracteristici și ușurința de utilizare, este un instrument inestimabil pentru dezvoltatori care lucrează cu datele Excel într-o varietate de aplicații.

More in this category