Conversion d'une feuille de calcul en image en PHP

Aspose.Cells - Conversion de la feuille de calcul en image

Pour convertir une feuille de calcul en image en utilisant Aspose.Cells for Java en PHP, appelez simplement le module Converter.

Code PHP

 $imageFormat = new ImageFormat();

//Instantiate a new workbook with path to an Excel file

$book = new Workbook($dataDir . "MyTestBook1.xls");

//Create an object for ImageOptions

$imgOptions = new ImageOrPrintOptions();

//Set the image type

$imgOptions->setImageFormat($imageFormat->getPng());

//Get the first worksheet.

$sheet = $book->getWorksheets()->get(0);

//Create a SheetRender object for the target sheet

$sr = new SheetRender($sheet, $imgOptions);

for ($j = 0; $j < $sr->getPageCount(); $j++)

{

    //Generate an image for the worksheet

    $sr->toImage($j, $dataDir . "mysheetimg" . $j . ".png");

}

Télécharger le code d’exécution

Télécharger**Conversion d’une feuille de calcul en image (Aspose.Cells)**à partir de l’un des sites de codage social mentionnés ci-dessous :