Sha256: 7369138a0d96e63724b179ee4312ec7829be3bc5219d719c4fc97074684e13f4
Contents?: true
Size: 1.51 KB
Versions: 6
Compression:
Stored size: 1.51 KB
Contents
#!/usr/bin/env ruby #Remember to install 'php5-cli' like under Ubuntu: apt-get install php5-cli #Load 'Php_process' through RubyGems. require "rubygems" require "php_process" php = Php_process.new #Load PHPExcel (can be downloaded here: 'http://phpexcel.codeplex.com/releases/view/45412') php.func("require_once", "#{File.dirname(__FILE__)}/PHPExcel/PHPExcel.php") #Create new PHPExcel object print "#{Time.now} Create new PHPExcel object\n" objPHPExcel = php.new("PHPExcel") #Set properties print "#{Time.now} Set properties\n" objPHPExcel.getProperties.setCreator("Maarten Balliauw") objPHPExcel.getProperties.setLastModifiedBy("Maarten Balliauw") objPHPExcel.getProperties.setTitle("Office 2007 XLSX Test Document") objPHPExcel.getProperties.setSubject("Office 2007 XLSX Test Document") objPHPExcel.getProperties.setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") #Add some data print "#{Time.now} Add some data\n" objPHPExcel.setActiveSheetIndex(0) objPHPExcel.getActiveSheet.SetCellValue('A1', 'Hello') objPHPExcel.getActiveSheet.SetCellValue('B2', 'world!') objPHPExcel.getActiveSheet.SetCellValue('C1', 'Hello') objPHPExcel.getActiveSheet.SetCellValue('D2', 'world!') #Rename sheet print "#{Time.now} Rename sheet\n"; objPHPExcel.getActiveSheet.setTitle('Simple') #Save Excel 2007 file print "#{Time.now} Write to Excel2007 format\n" objWriter = php.new("PHPExcel_Writer_Excel2007", objPHPExcel) objWriter.save(__FILE__.gsub(".rb", ".xlsx")) #Echo done print "#{Time.now} Done writing file.\n"
Version data entries
6 entries across 6 versions & 1 rubygems