Monday, June 21, 2010

VFP and OpenOffice

* OpenOffice.org automation
* Sample from http://udk.openoffice.org/common/
* man/tutorial/office_automation.html
* Translated to VFP code
* Ted Roche, 30 Dec 2001

LOCAL loOfcMgr, loDesktop, loDocument, args(1), ;
loCoreReflection, loPropertyValue, loText,;
loCursor

* Create the Service Manger and Desktop
loOfcMgr = CreateObject(;
"com.sun.star.ServiceManager")
loDesktop = loOfcMgr.createInstance(;
"com.sun.star.frame.Desktop")

* The args array is an array of "PropertyValue"
* objects - create by invoking OO.o reflection
loCoreReflection = loOfcMgr.createInstance( ; "com.sun.star.reflection.CoreReflection" )
loPropertyValue = CREATEOBJECT("Empty")
loCoreReflection.forName( ;
"com.sun.star.beans.PropertyValue"). ;
createobject(@loPropertyValue)
args[1] = loPropertyValue
args[1].name = "ReadOnly"
args[1].value = .F.

* Tell VFP to pass arrays to the loDesktop object
* as zero-based, by reference
COMARRAY(loDesktop,10)

* Open a new empty writer document
loDocument = loDesktop.loadComponentFromURL(;
"private:factory/swriter","_blank", 0, @args)

* Insert sample Text
loText=loDocument.getText() && Create text object

* Create a cursor object (position pointer)
loCursor= loText.createTextCursor()
loText.insertString(loCursor, ;
"The first line in the created text document."+;
CHR(10) + "Fox Rocks!", .F.)

Saturday, June 12, 2010

NEW INHALER



I found this one in the facebook then it made me smile and realize that it could be useful in the blog of snake,I'm sure he'll laugh at this. Dude you'll never gonna hang out somewhere else, you can easily use this anywhere, anytime, aside from that its handy, like your salbutamol. :)