久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

將VFP的DBF導(dǎo)出到WORD(可以打印任意字段內(nèi)容)

 王咸美 2013-08-02
* 編號(hào):A0019
* 功能:將VFP的DBF導(dǎo)出到WORD
* 說明:通用型字段內(nèi)容用Gen表示,、備注型字段內(nèi)容用Memo表示

SET TALK OFF
SET SAFETY OFF
SET DATE TO YMD
SET MARK TO "-"
SET CENTURY ON
SET COMPATIBLE OFF

LOCAL my_title,my_alias
SET PATH TO D:\表
my_alias="檔案"
my_title= " "
my_dbfopen=.F.
IF EMPTY(my_alias)
RETURN
ENDIF

IF !USED(my_alias)
USE &my_alias IN 0
ELSE
SELECT (my_alias)
my_dbfopen=.T.
ENDIF
SELECT(my_alias)
IF EOF()
GO TOP
IF EOF()
IF my_dbfopen=.F.
SELECT(my_alias)
USE
ENDIF
RETURN
ENDIF
ENDIF
IF EMPTY(ALLTRIM(my_title))
my_title=my_alias
ENDIF
WAIT "正在訪問 Word 軟件……" WINDOW NOWAIT
WordApp=CREATEOBJECT("Word.application")   &&訪問WORD
If Type("WordApp")#"O"
WAIT CLEAR
MessageBox( "訪問Word失敗,!請(qǐng)檢查你的系統(tǒng)是否正確安裝 Word 軟件,!",48,"沒有安裝Word")
RETURN
ENDIF
WAIT "正在生成表格……" WINDOW NOWAIT
WordApp.Visible =.T.
WordApp.Documents.Add
*WordApp.ActiveDocument.PageSetup.PageWidth=18.4/0.035  &&設(shè)置頁(yè)寬
*WordApp.ActiveDocument.PageSetup.PageHeight=26/0.035   &&設(shè)置頁(yè)高
WordApp.ActiveDocument.PageSetup.LinesPage = 35         &&設(shè)置每頁(yè)打印行數(shù)
WordApp.Documents(1).Range.Text=ALIAS()+"一覽表"
WordApp.Documents(1).Range.Font.Size= 15
WordApp.Documents(1).Range.Font.Name="黑體"
WordApp.Documents(1).Range.Paragraphs.Alignment= 1

#define NUM_AFIELDS 16
PUBLIC aWizFList
DIMENSION aWizFList[1]
=AFIELDS(aWizFList)

LOCAL  mytextzhi
SELECT(my_alias)
GO top
myfcount=fcount()
WordAppRang=WordApp.Documents(1).Range(LENC(WordApp.Documents(1).Range.Text)-1,LENC(WordApp.Documents(1).Range.Text)-1)
WordTable=WordApp.Documents(1).Tables.Add(WordAppRang,RECCOUNT()+1,myfcount)
WordTable.Range.Paragraphs.Alignment= 0
WordTable.Range.Font.Name="宋體"
WordTable.Range.Font.Size=10
WordTable.Borders.Enable=1
WordTable.Borders(1).LineWidth = 12
WordTable.Borders(2).LineWidth = 12
WordTable.Borders(3).LineWidth = 12
WordTable.Borders(4).LineWidth = 12
WordTable.Rows(1).Borders(3).LineWidth = 12
WordTable.Rows(1).Range.Font.Bold=.t.
WordTable.Rows(1).Cells.VerticalAlignment= 1
WordTable.Rows(1).Range.Paragraphs.Alignment = 4    && 分散對(duì)齊
WordTable.Rows(1).HeadingFormat=.t.
 
FOR j=1 to RECCOUNT()
FOR i=1 to fcount()
  if INLIST(aWizFList[i,2],"G")
    WordTable.Cell(1,i).Range.Text=field(i)
    WordTable.Rows(j+1).Cells(i).Range.Text="Gen"
 else
   if INLIST(aWizFList[i,2],"M")
    WordTable.Cell(1,i).Range.Text=field(i)
    WordTable.Rows(j+1).Cells(i).Range.Text="Memo"
   else
    myzdm=aWizFList[i,1]
    mytextzhi=EVALUATE(myzdm)
    IF EMPTY(mytextzhi) OR ISNULL(mytextzhi)
       mytextzhi="  "
    ELSE
      DO CASE
        CASE INLIST(aWizFList[i,2],"C")
          mytextzhi=ALLTRIM(mytextzhi)
        CASE INLIST(aWizFList[i,2],"M")
          mytextzhi=TRIM(mytextzhi)
          mytextzhi=STRTRAN(mytextzhi,CHR(13),' ')
        CASE INLIST(aWizFList[i,2],"N")
          mywidth=aWizFList[i,3]
          mydwidth=aWizFList[i,4]
          mytextzhi=allt(STR(mytextzhi,mywidth,mydwidth))
        CASE INLIST(aWizFList[i,2],"Y")
          mytextzhi=ALLTRIM(STR(mytextzhi,20,4))
        CASE INLIST(aWizFList[i,2],"I","B","F")
          mytextzhi=ALLTRIM(STR(mytextzhi))
        CASE aWizFList[i,2]="D"
          mytextzhi=DTOC(mytextzhi)
        CASE aWizFList[i,2]="T"
          mytextzhi=TTOC(mytextzhi)
        CASE aWizFList[i,2]="L"
          IF mytextzhi=.T.
            mytextzhi="是"
          ELSE
            mytextzhi="否"
         ENDIF
       OTHER= "    "
     ENDCASE
     IF EMPTY(mytextzhi) OR ISNULL("mytextzhi")
        mytextzhi="   "
     ENDIF
     WordTable.Cell(1,i-k).Range.Text = aWizFList[i,1]
     WordTable.rows(j+1).cells(i-k).Range.InsertAfter(mytextzhi)
  ENDIF
 endif
endif
NEXT i
  SKIP 1
NEXT j   
WordTable.Columns().AutoFit

* 下面為頁(yè)面設(shè)置
WordApp.ActiveDocument.PageSetup.PaperSize=7
WordApp.ActiveDocument.PageSetup.Orientation=0 &&頁(yè)面豎放 0-豎放  1-橫放
*WordTable.Rows.HorizontalPosition=-999995              &&表格水平居中
WordApp.ActiveDocument.PageSetup.TopMargin=22.0*2.835  &&設(shè)置上邊距
WordApp.ActiveDocument.PageSetup.BottomMargin=22.0*2.835  &&設(shè)置下邊距
WordApp.ActiveDocument.PageSetup.LeftMargin=19.0*2.835     &&設(shè)置左邊距
WordApp.ActiveDocument.PageSetup.RightMargin=19.0*2.835    &&設(shè)置右邊距
WordApp.ActiveDocument.PageSetup.VerticalAlignment=0       &&頁(yè)面對(duì)齊方;式 0-上  1-中  2-下
WordApp.ActiveDocument.PageSetup.HeaderDistance=22.0*2.835  &&頁(yè)眉位置
WordApp.ActiveDocument.PageSetup.FooterDistance=19.0*2.835   &&頁(yè)腳位置
mydate=subst(dtos(date()),1,4)+"年"+subst(dtos(date()),5,2)+;
"月"+subst(dtos(date()),7,2)+"日"
WordApp.Documents(1).Sections(1).Headers(1).Range.Text="制表期: ;
"+mydate+" "         &&頁(yè)眉
WordApp.Documents(1).Sections(1).Headers(1).Range.Paragraphs.Alignment=2               &&頁(yè)眉右齊
WordApp.Documents(1).Sections(1).Footers(1).Range.Paragraphs.Alignment= 2              &&頁(yè)腳居中
WordApp.Documents(1).Sections(1).Footers(1).Range.Select
WordApp.Selection.InsertAfter("第")
WordApp.Selection.Start =WordApp.Selection.End
WordApp.Selection.InsertFormula("PAGE")
WordApp.Selection.Start =WordApp.Selection.End
WordApp.Selection.InsertBefore("頁(yè)/共")
WordApp.Selection.Start =WordApp.Selection.End
WordApp.Selection.InsertFormula("NUMPAGES")
WordApp.Selection.Start =WordApp.Selection.End
WordApp.Selection.InsertBefore("頁(yè)")
WordApp.Selection.Range.Paragraphs.Alignment= 1
WordTable.Rows(1).HeadingFormat=.t.
WordTable.Columns().AutoFit                         &&自動(dòng)調(diào)整列寬                 
WordApp.Documents(1).SaveAs("E:\"+my_title+".doc")    &&自動(dòng)保存文件
RELEASE WordApp
WAIT CLEAR
MessageBox( "生成Word文件完畢,,文件位置E:\"+my_title+".doc,!",64,"完畢")
RETURN

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多