Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Save report
Message
From
21/04/1998 11:26:52
 
 
To
17/04/1998 14:51:30
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Miscellaneous
Thread ID:
00083852
Message ID:
00093673
Views:
49
Cetin,
Thank you, I'll try it.
Alex.
>>The app which I'm working on is the query builder and the reporting needs to be very flexible. Basically users should be able to choose what to print and how through an easy interface. They won't use report designer, but I wanted to massage the basic .frx instead, based on their selection. And that approach works fine, the problem is with the hard copy of their reports. FoxWord lets you save the report in Word doc, but Foxword doesn't work under NT.
>Well I don't also have foxword and prefer talking to word. The below code is from one of my projects and sending data to word (from an optiongroup - send to word). Users could then format their word anyway they want (fields are under mergefield tab) :
lparameters nScopeOption  && 1-Thisform.rcno 2-All records
>cDefDir = sys(5)+curdir()
>cTempFile = cDefDir+"t"+right(sys(2015),7)
>cFlds = ""
>for ix = 1 to fcount()
>	if !type(field(ix))$"LG"
>		cFlds = cFlds+iif(empty(cFlds),"",",")+field(ix)
>	endif	
>endfor
>if nScopeOption = 2
>	cWhere = iif(!empty(set("filter"))," where "+strtran(lower(set("filter")),"hasta.",""), "")
>	select &cFlds from hasta &cWhere into table (cTempFile)
>else
>	select &cFlds from hasta where recno() = thisform.rcno into table (cTempFile)
>endif
>cDataFullPath = dbf(alias())
>use in (alias())
>select hasta
>cDSN = "DSN=FoxPro Files;DBQ="+cDefDir+";DefaultDir="+cDefDir+";"
>cSourceDB = ""
>cSourceType = ""
>cOther = "DriverId=536;MaxBufferSize=512;PageTimeout=5;"
>cSQLStatement = "SELECT * FROM "+cTempFile
>cDataFile = cTempFile+".dbf"
>Public oWordDocument
>oWordDocument = createobject("word.basic")
>with oWordDocument
>    .FileNewDefault()
>    tcWaitWindowClass = this.findwindowclass("Microsoft Word - Document1")
>	.InsertDatabase(35,511,0, ;
>		cDSN+cSourceDb+cSourceType+cOther, ;
>		cSQLStatement,,,,cDataFile,,,1)
>	.filesaveas(ctempFile,0)			&& Save as a word doc for mailmerge
>	.fileclose(1)						&& Close saving
>* Datasource ready, now create mailmerge main document
>	.filenewdefault()     && A template could be here
>	.MailMergeOpenDataSource(cTempFile+".doc")  && Set saved file as data source for mailmerge (Directly a table could be set via ODBC)
>	.MailMergeEditMainDocument			&& Activate the main document
>	.AppShow
>endwith
>do while this.findwindowhandle(tcWaitWindowClass)<>0
>enddo
>release oWordDocument
>erase (cTempFile+".*")
>
>*****
>* findwindowclass method
>* Prefer class for Title is likely to change
>*****
>lparameters tcWintitle
>DECLARE integer FindWindow in WIN32API string cNull, string cWinName
>declare integer GetClassName in WIN32API integer hWnd, string @cClass, integer nMaxBuffer
>hWnd = FindWindow(0,tcWintitle)
>lpClassName = space(200)
>nBufLen = GetClassName(hWnd,@lpClassName,200)
>clear dlls
>return substr(lpClassName,1,nBufLen)
>
>*****
>* findwindowhandle method
>* Prefer class for Title is likely to change
>*****
>lparameter tcWinClass
>DECLARE integer FindWindow in WIN32API string cNull, string cWinName
>nHWND = FindWindow(tcWinClass,0)
>clear dlls
>return nHWND
>
>Cetin
MS,MCP
Previous
Reply
Map
View

Click here to load this message in the networking platform