note 114847 added to class.dotnet
| From: | ricardopsj at gmail dot com | Date: | Mon, 14 Apr 2014 01:30:29 +0000 |
| Subject: | note 114847 added to class.dotnet | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199263@lists.php.net to get a copy of this message | ||
Create an Excel Workbook using DOTNET.
<?php
$full_assembly_string = 'Microsoft.Office.Interop.Excel, Version=14.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c';
$full_class_name = 'Microsoft.Office.Interop.Excel.ApplicationClass';
$e = new DOTNET($full_assembly_string, $full_class_name);
$wb = $e->workbooks->add();
$Precios = $wb->Worksheets(1);
$Precios->Name = 'Precios';
$Venta = $wb->Worksheets(2);
$Venta->Name = 'Venta';
$Tons = $wb->Worksheets(3);
$Tons->Name = 'Tons';
$Meses = Array('2014-01', '2014-02', '2014-03', '2014-04',
'2014-05', '2014-06', '2014-07', '2014-08',
'2014-09', '2014-10', '2014-11', '2014-12');
foreach ($Meses as $Numero => $Mes) {
$Precios->Range("A" . ($Numero+1))->Value = $Mes;
}
$wb->SaveAs('c:\temp\Meta.2014.05.xlsx');
$wb->Close();
?>
Go to c:\windows\assembly to know what value to put in $full_assembly_string.
If you don't know the assembly, use http://www.red-gate.com/products/dotnet-development/reflector/
to browse it, use what you learn there to fill $full_class_name.
Enjoy,
Ricardo.
----
Server IP: 72.52.91.14
Probable Submitter: 190.46.187.73
----
Manual Page -- http://php.net/manual/en/class.dotnet.php
Edit -- https://master.php.net/note/edit/114847
Del: integrated -- https://master.php.net/note/delete/114847/integrated
Del: useless -- https://master.php.net/note/delete/114847/useless
Del: bad code -- https://master.php.net/note/delete/114847/bad+code
Del: spam -- https://master.php.net/note/delete/114847/spam
Del: non-english -- https://master.php.net/note/delete/114847/non-english
Del: in docs -- https://master.php.net/note/delete/114847/in+docs
Del: other reasons-- https://master.php.net/note/delete/114847
Reject -- https://master.php.net/note/reject/114847
Search -- https://master.php.net/manage/user-notes.php