Recently I had a project that needed to create and format a word document, based on data from a MySQL database. While the solution was on an MS platform that had Word available, I could only use PHP for the scripting language as it was a language that was used by the rest of the team. The system would call the Word com object, create a new word document and formatted a report, using the “word.application” COM object.
One issue I ran across was that that coloring a font object in any VBA Macro script often times used a simple built-in function called “RGB”. I translated a PERL version below that seems to work quite well in PHP. Hope this helps someone else. This can also be used in formated RGB values in Excel document manipulations.
function phpRGB ($r,$g,$b){
return $r + (256*$g) + (65536*$b);
}
//example usage:
$wobj->Selection->Font->Italic = 1;
$wobj->Selection->Font->Color = phpRGB(153,204,255);
Here is a snippet of code that I wish I had when I needed to write a small routine to output a PHP RSS feed.
RSS Feeds are XML-like so they need to be carefully crafted.
1.) Setup the main header of the rss feed. Remember to carefully escape all of your text going into string
fields using htmlentities().
Read more…
Created a personalized Robot Agent, based on Silva Tech’s flexible data extraction, reporting and crawling framework (DERC Framework, a Silva Tech Solutions framework) that has saved Mr. Gordon countless hours of monitoring his target system himself and responding to the monotonous events. The agent was setup on a very specific schedule, authenticated into a third party application system, searched for a very specific criteria and automatically submitted data. The agent monitored and reacted differently to a certain set of resulting events that were returned from the application system. The Crawl Agent would then email Mr. Gordon and shut itself down. Mr. Gordon could easily control his personalized DERC Framework agent, from a custom built secure web interface. The DERC Framework is a very flexible proprietary data extraction, reporting and crawling framework that Mr. Silva has been building upon and refining for five years.