β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ PHP4 COM function (windows version) : FULL
PART 4
twitter.com/UNDERCODETC
π¦ ππΌππ πππΈβπ :
"; #Open workbook
so that we can use it
$ wkb = $ ex-> application-> Workbooks-> Open ($ workbook) or Die (" Did not open " );
# Pre-save the original workbook, create a copy of the workbook
$ ex-> Application->
# $ ex-> Application-> Visible = 1; #This sentence goes to comment to make Excel visible
# Read and write a cell in a new worksheet
# We can read this cell E11 (Advertising in the 4th. Quarter)
$ sheets = $ wkb-> Worksheets ($ sheet); #Select the sheet
$ sheets-> activate; #Activate it
$ cell = $ sheets-> Cells (11,5); #Select the cell (Row Column number)
$ cell-> activate; #Activate the cell
print "Old Value = {$ cell-> value}
"; #Print the value of the cell: 10000
$ cell-> value = 15000; #Change it to 15000
print "New value = {$ cell-> value}
"; #Print the new value = 15000 #Finally
, recalculate this cell with the new value
$ sheets-> Calculate; #Required
if you want to calculate, manual is optional
# Can see Total effect value (cell E13)
$ cell = $ sheets-> Cells (13,5); #Select the cell (Row Column number)
$ number = Number_format ($ cell-> value);
print "New Total cost = $$ number-was $ 47,732 before.
" ;
#According to the calculation formula, the advertisement affects the company's expenses, here will display $ 57,809 #using the
Excel built-in function
# PMT (percent / 12 months, Number of payments, Loan amount)
$ pay = $ ex-> application-> pmt (0.08 / 12,10,10000);
$ pay = sprintf ("%. 2f", $ pay);
print "Monthly payment for $ 10,000 loan @ 8% interest / 10 months: $ $ pay
";
#Should print monthly payment = $ -1,037.03 #Optional
, save
$ ex-> Application-> ActiveWorkbook-> SaveAs ("Ourtest"); #Close
without asking
$ ex-> application-> ActiveWorkbook-> Close ("False");
unset ($ ex);
?>
Written by UndercOde
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ PHP4 COM function (windows version) : FULL
PART 4
twitter.com/UNDERCODETC
π¦ ππΌππ πππΈβπ :
"; #Open workbook
so that we can use it
$ wkb = $ ex-> application-> Workbooks-> Open ($ workbook) or Die (" Did not open " );
# Pre-save the original workbook, create a copy of the workbook
$ ex-> Application->
# $ ex-> Application-> Visible = 1; #This sentence goes to comment to make Excel visible
# Read and write a cell in a new worksheet
# We can read this cell E11 (Advertising in the 4th. Quarter)
$ sheets = $ wkb-> Worksheets ($ sheet); #Select the sheet
$ sheets-> activate; #Activate it
$ cell = $ sheets-> Cells (11,5); #Select the cell (Row Column number)
$ cell-> activate; #Activate the cell
print "Old Value = {$ cell-> value}
"; #Print the value of the cell: 10000
$ cell-> value = 15000; #Change it to 15000
print "New value = {$ cell-> value}
"; #Print the new value = 15000 #Finally
, recalculate this cell with the new value
$ sheets-> Calculate; #Required
if you want to calculate, manual is optional
# Can see Total effect value (cell E13)
$ cell = $ sheets-> Cells (13,5); #Select the cell (Row Column number)
$ number = Number_format ($ cell-> value);
print "New Total cost = $$ number-was $ 47,732 before.
" ;
#According to the calculation formula, the advertisement affects the company's expenses, here will display $ 57,809 #using the
Excel built-in function
# PMT (percent / 12 months, Number of payments, Loan amount)
$ pay = $ ex-> application-> pmt (0.08 / 12,10,10000);
$ pay = sprintf ("%. 2f", $ pay);
print "Monthly payment for $ 10,000 loan @ 8% interest / 10 months: $ $ pay
";
#Should print monthly payment = $ -1,037.03 #Optional
, save
$ ex-> Application-> ActiveWorkbook-> SaveAs ("Ourtest"); #Close
without asking
$ ex-> application-> ActiveWorkbook-> Close ("False");
unset ($ ex);
?>
Written by UndercOde
β β β ο½ππ»βΊπ«Δπ¬πβ β β β