Home > database >  Is there any way directly to load WORD format to report it
Is there any way directly to load WORD format to report it

Time:09-21

The format of the word has designed
If the report inside do
To draw a lot of line and to adjust position
It takes a lot of time to complete the word, the simple things

CodePudding user response:

The Clear
OWord=CREATEOBJECT (' Word. Application ')
OWord. Documents. The Open (GetFile ())
NPages has=oWord.ActiveDocument.Com puteStatistics (2) & amp; & Number of Pages
NWords=oWord.ActiveDocument.Com puteStatistics (0) & amp; & The Number of Words
NLines=oWord.ActiveDocument.Com puteStatistics (1) & amp; & Number Of Lines
NChars=oWord.ActiveDocument.Com puteStatistics (3) & amp; & Number Of Characters, no Spaces
NPara=oWord.ActiveDocument.Com puteStatistics (4) & amp; & Number Of Paragraphs
NCharSp=oWord.ActiveDocument.Com puteStatistics (5) & amp; & Number Of Characters with Spaces
? "Pages:" + Transform (nPages has)
? "Words:" + Transform (nWords)
? "Number of lines:" + Transform (nLines)
? "Paragraph:" + Transform (nPara)
? "Character (with Spaces) :" + Transform (nCharSp)
OWord. Quit (. F.)
OWord=. NULL.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * *

VFP call WORD, for example,
* VFP_WORD.prg, VFP via OLE Word and generate new file:
Ow1=CreateObject (" Word. Basic ")
C_WordVer=ow1. AppInfo (2) & amp; & Word version
Ow1. AppShow
IF c_WordVer=[8.0]
Ow1. AppMaximize
ENDIF
Ow1. FileNewDefault

* * * makes the character number after the default font of song typeface:
Ow1. StartOfLine
Ow1. EndOfLine (1)
Ow1. The Font (" tahoma ")

Ow1. CenterPara
Ow1. The Font (" regular script _gb2312 ")
Ow1. FontSize (42)

* at the beginning of words: 42, no. 1:26, no. 2:22, no. 3:16,
* 4 words: 14, 5 words: 10.5, 6 words: 7.5
Ow1. FontSize (16)
Ow1. Insert (" so-and-so unit ")
Ow1. The Font (" tahoma ")
Ow1. FontSize (7.5)
Ow1. Insert (" XXXX table ")
Ow1. Insertpara

Ow1. Leftpara
Ow1. Insertpara
Ow1. Insertpara
Ow1. The Font (" tahoma ")
Ow1. FontSize (10.5)
Ow1. Insert (" zhang SAN ZhangShan 1963.01.23 1234.56 ")
Ow1. Insertpara
Ow1. Insert (" li si LiSi 1974.04.01 876.54 ")
Ow1. Insertpara
Ow1. Insert (" fifty and WangWu 1985.12.31 765.43 ")
Ow1. Insertpara
Ow1. Insert (" zhao money sun li ZhaoQianSunLi 1900.01.01 5432.10 ")
Ow1. Insertpara
Ow1. Insert (" TAB: XXX ")
Ow1. Insertpara

IF c_WordVer=[7.0]
Ow1. ToolsOptionsGeneral (,,,,,,,,,,,,,,, 2)
ENDIF
IF c_WordVer=[8.0]
Ow1. ToolsOptionsGeneral (t.,. F.,. F., the F,. T.,. F.,. F.,. F., the t.,. T., 2,. T.,. T.,. T.)
ENDIF
Ow1. FilePageSetup (0, 1, "12", "12", "10", "10", "0")
IF MESSAGEBOX (/print preview?=6, 4 + 32)
IF ow1. FilePrintPreview ()!=1
Ow1. FilePrintPreview
ENDIF
ENDIF
WAIT [press any key to continue... The WINDOW a TIMEOUT 60
IF ow1. FilePrintPreview ()=1
Ow1. ClosePreview
ENDIF
IF MESSAGEBOX (/inventory?=6, 4 + 32)
Ow1. FileSaveAs (" TEST1. DOC ") & amp; & The default directory: C: \ My Documents
The ELSE
Ow1. SetDocumentDirty (0) & amp; & The document as a "clean" processing
Ow1. FileClose
ENDIF
* ow1 FileExit (2) & amp; & Withdraw from the Word, don't save the modified document out
* or:
* ow1 FileQuit (2) & amp; & Withdraw from the Word, don't save the modified document out
* or:
Ow1. AppClose
RELEASE ow1
RETURN

CodePudding user response:

reference 1st floor kangss response:
Clear
OWord=CREATEOBJECT (' Word. Application ')
OWord. Documents. The Open (GetFile ())
NPages has=oWord.ActiveDocument.Com puteStatistics (2) & amp; & Number of Pages
NWords=oWord.ActiveDocument.Com puteStatistics (0) & amp; & The Number of Words
NLines=oWord.ActiveDocument.Com puteStatistics (1) & amp; & Number Of Lines
NChars=oWord.ActiveDocument.Com puteStatistics (3) & amp; & Number Of Characters, no Spaces
NPara=oWord.ActiveDocument.Com puteStatistics (4) & amp; & Number Of Paragraphs
NCharSp=oWord.ActiveDocument.Com puteStatistics (5) & amp; & Number Of Characters with Spaces
? "Pages:" + Transform (nPages has)
? "Words:" + Transform (nWords)
? "Number of lines:" + Transform (nLines)
? "Paragraph:" + Transform (nPara)
? "Character (with Spaces) :" + Transform (nCharSp)
OWord. Quit (. F.)
OWord=. NULL.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * *

VFP call WORD, for example,
* VFP_WORD.prg, VFP via OLE Word and generate new file:
Ow1=CreateObject (" Word. Basic ")
C_WordVer=ow1. AppInfo (2) & amp; & Word version
Ow1. AppShow
IF c_WordVer=[8.0]
Ow1. AppMaximize
ENDIF
Ow1. FileNewDefault

* * * makes the character number after the default font of song typeface:
Ow1. StartOfLine
Ow1. EndOfLine (1)
Ow1. The Font (" tahoma ")

Ow1. CenterPara
Ow1. The Font (" regular script _gb2312 ")
Ow1. FontSize (42)

* at the beginning of words: 42, no. 1:26, no. 2:22, no. 3:16,
* 4 words: 14, 5 words: 10.5, 6 words: 7.5
Ow1. FontSize (16)
Ow1. Insert (" so-and-so unit ")
Ow1. The Font (" tahoma ")
Ow1. FontSize (7.5)
Ow1. Insert (" XXXX table ")
Ow1. Insertpara

Ow1. Leftpara
Ow1. Insertpara
Ow1. Insertpara
Ow1. The Font (" tahoma ")
Ow1. FontSize (10.5)
Ow1. Insert (" zhang SAN ZhangShan 1963.01.23 1234.56 ")
Ow1. Insertpara
Ow1. Insert (" li si LiSi 1974.04.01 876.54 ")
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • VFP
  • Related