public static function run($dataDir = null)
 {
     $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");
     }
     // Print message
     print "Images generated successfully." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     $saveFormat = new SaveFormat();
     $path = $dataDir . "Template.xlsx";
     //Create a workbook object from the template file
     $workbook = new Workbook($path);
     //Convert each worksheet into svg format in a single page.
     $imgOptions = new ImageOrPrintOptions();
     $imgOptions->setSaveFormat($saveFormat->SVG);
     $imgOptions->setOnePagePerSheet(true);
     //Convert each worksheet into svg format
     $sheetCount = $workbook->getWorksheets()->getCount();
     for ($i = 0; $i < $sheetCount; $i++) {
         $sheet = $workbook->getWorksheets()->get($i);
         $sr = new SheetRender($sheet, $imgOptions);
         $pageCount = $sr->getPageCount();
         for ($k = 0; $k < $pageCount; $k++) {
             //Output the worksheet into Svg image format
             $sr->toImage($k, $path . $sheet->getName() . $k . ".out.svg");
         }
     }
     // Print message
     print "Excel to SVG conversion completed successfully.";
 }