本文整理匯總了PHP中COM::Set方法的典型用法代碼示例。如果您正苦於以下問題:PHP COM::Set方法的具體用法?PHP COM::Set怎麽用?PHP COM::Set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類COM
的用法示例。
在下文中一共展示了COM::Set方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
public static function run($dataDir = null)
{
if (is_null($dataDir)) {
die("Data Directory Undefined");
}
// Create Aspose.Cells Helper Object
$ptr = new \COM('Aspose.Cells.Interop.InteropHelper');
// Opening through Path
// Creating a Workbook object and opening an Excel file using its file path
$workbook = $ptr->New("Aspose.Cells.Workbook", array());
$worksheets = $ptr->Get($workbook, "Worksheets", array());
$sheetIndex = $ptr->Call($worksheets, "Add", array());
$worksheet = $ptr->Get($worksheets, "Item", array($sheetIndex));
$cells = $ptr->Get($worksheet, "Cells", array());
$a1 = $ptr->Get($cells, "Item_3", array("A1"));
$ptr->Call($a1, "PutValue", array(1));
$a2 = $ptr->Get($cells, "Item_3", array("A2"));
$ptr->Call($a2, "PutValue", array(2));
$a3 = $ptr->Get($cells, "Item_3", array("A3"));
$ptr->Call($a3, "PutValue", array(3));
$a4 = $ptr->Get($cells, "Item_3", array("A4"));
$ptr->Call($a3, "PutValue", array(3));
$ptr->Call($workbook, "Save", array($dataDir . "/output.xls"));
$ptr->Set($a4, "Formula", "=SUM(A1:A3)", array());
$ptr->Call($workbook, "CalculateFormula", array());
$value = $ptr->Get($a4, "Value", array());
$stringVal = $ptr->Call($value, "ToString", array());
print "Calculated Value: " . $stringVal . PHP_EOL;
$ptr->Call($workbook, "Save", array($dataDir . "/output.xls"));
print "Completed." . PHP_EOL;
}
示例2: run
public static function run($dataDir = null)
{
if (is_null($dataDir)) {
die("Data Directory Undefined");
}
// Create Aspose.Cells Helper Object
$ptr = new \COM('Aspose.Cells.Interop.InteropHelper');
// Opening through Path
// Creating a Workbook object and opening an Excel file using its file path
$workbook = $ptr->New("Aspose.Cells.Workbook", array($dataDir . '/MyTestBook1.xls'));
$worksheets = $ptr->Get($workbook, "Worksheets", array());
$sheet = $ptr->Get($worksheets, 'Item', array(0));
$imgOptions = $ptr->New("Aspose.Cells.Rendering.ImageOrPrintOptions", array());
$imageFormat = new \DOTNET('mscorlib', 'System.Drawing.Imaging.ImageFormat');
$ptr->Set($imgOptions, 'ImageFormat', $imageFormat->Jpeg, array());
$ptr->Set($imgOptions, 'OnePagePerSheet', true, array());
$sr = $ptr->New("Aspose.Cells.Rendering.SheetRender", array($sheet, $imgOptions));
$bitmap = new \DOTNET("mscorlib", "System.Drawing.Bitmap");
$bitmap->Save($dataDir . "./SheetImage.jpg");
print "Conversion to Image(s) completed!" . PHP_EOL;
}
示例3: run
public static function run($dataDir = null)
{
if (is_null($dataDir)) {
die("Data Directory Undefined");
}
// Create Aspose.Cells Helper Object
$ptr = new \COM('Aspose.Cells.Interop.InteropHelper');
// Opening through Path
// Creating a Workbook object and opening an Excel file using its file path
$workbook = $ptr->New("Aspose.Cells.Workbook", array($dataDir . '/book1.xls'));
$worksheets = $ptr->Get($workbook, "Worksheets", array());
$worksheet_index = $ptr->Call($worksheets, "Add_2", array());
$worksheet = $ptr->Get($worksheets, "Item", array($worksheet_index));
$ptr->Set($worksheet, "Name", "My Worksheet", array());
$ptr->Call($workbook, "Save", array($dataDir . "/output.xls"));
print "Completed." . PHP_EOL;
}
示例4: run
public static function run($dataDir = null)
{
if (is_null($dataDir)) {
die("Data Directory Undefined");
}
// Create Aspose.Cells Helper Object
$ptr = new \COM('Aspose.Cells.Interop.InteropHelper');
// Opening through Path
// Creating a Workbook object and opening an Excel file using its file path
$workbook = $ptr->New("Aspose.Cells.Workbook", array($dataDir . '/Book1.xls'));
$XOR = $ptr->New("Aspose.Cells.EncryptionType.XOR", array());
$crypt = $ptr->New("Aspose.Cells.EncryptionType.StrongCryptographicProvider", array());
$ptr->Call($workbook, "SetEncryptionOptions", array($XOR, 40));
$ptr->Call($workbook, "SetEncryptionOptions", array($crypt, 128));
$settings = $ptr->Get($workbook, "Settings", array());
$ptr->Set($settings, "Password", "1234", array());
$ptr->Call($workbook, "Save", array($dataDir . "/encryptedoutBook1.xls"));
print "Completed." . PHP_EOL;
}