| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1837 人关注过本帖
标题:vfp的dbf写入word表格中数值0怎样显示
只看楼主 加入收藏
王咸美
Rank: 1
等 级:新手上路
帖 子:579
专家分:0
注 册:2018-1-4
结帖率:97.04%
收藏
已结贴  问题点数:20 回复次数:9 
vfp的dbf写入word表格中数值0怎样显示
vfp的dbf写入word表格中怎样显示数值0
搜索更多相关主题的帖子: dbf word 表格 数值 显示 
2018-01-09 20:32
王咸美
Rank: 1
等 级:新手上路
帖 子:579
专家分:0
注 册:2018-1-4
收藏
得分:0 
请哪位高手帮帮忙,万分感谢!!!
2018-01-10 12:12
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9799
专家分:26886
注 册:2012-2-5
收藏
得分:20 
经常用VFP控制WORD,只有靠自己研究了。

坚守VFP最后的阵地
2018-01-10 13:36
schtg
Rank: 12Rank: 12Rank: 12
来 自:https://t.me/pump_upp
等 级:贵宾
威 望:67
帖 子:1545
专家分:3003
注 册:2012-2-29
收藏
得分:0 
需要显示,还是不需要显示?
2018-01-10 13:54
wengjl
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:109
帖 子:2197
专家分:3838
注 册:2007-4-27
收藏
得分:0 
1、创建Word文档
Appword=CreateObject("word.application")
2、显示Word文档
Appword.Visible=.t.
3、建立新文档
Appword.Documents.Add()
4、文档另存为
Appword.ActiveDocument.SaveAs("E:\abc.doc")
5、打开文档
Appword.ActiveDocument.Open("E:\abc.doc")
6、保存
Appword.ActiveDocument.Save
7、关闭
Appword.ActiveDocument.Close
8、退出
Appword.Application.Quit
9、打印
Appword.ActiveDocument.PrintOut
10、设置上页边距
Appword.ActiveDocument.PageSetup.TopMargin=1.5/0.035
11、设置下页边距
Appword.ActiveDocument.PageSetup.BottomMargin=1.5/0.035
12、设置左页边距
Appword.ActiveDocument.PageSetup.LeftMargin=1.5/0.035
13、设置右页边距
Appword.ActiveDocument.PageSetup.RightMargin=1.5/0.035
14、设置页宽
Appword.ActiveDocument.PageSetup.PageWidth=18.4/0.035
15、设置页高
Appword.ActiveDocument.PageSetup.PageHeight=26/0.035
16、设置页面竖放
Appword.ActiveDocument.PageSetup.Orientation=1  
17、设置页面横放
Appword.ActiveDocument.PageSetup.Orientation=2
18 、指定网格
Appword.ActiveDocument.PageSetup.LayoutMode=0    && 0--不指定网格1--指定网格和字符网格 2--指定行网格 3--文字对齐网格
19、设置每页行数
Appword.ActiveDocument.PageSetup.LinesPage=42
20、设置每行字数
Appword.ActiveDocument.PageSetup.ChartLine=10
21、页面设为4栏
Appword.ActiveDocument.PageSetup.TextColumns.SetCount(4)
22、设置栏宽
Appword.ActiveDocument.PageSetup.TextColumns.Width=3/0.035
23、设置栏间距
Appword.ActiveDocument.PageSetup.TextColumns.Specing=0.5/0.035
24、插入文字
Appword.Selection.Text="如果创建了工具栏"
25、插入文字
Appword.Selection.InsertAfter(space(6)+"多谢贵公司的支持!")
26、指定字号
Appword.Selection.FontSize=10.5
27、设置对齐方式
Appword.Selection.ParagraphFormat.Alignment=0 && 0为左对齐 1居中 2右对齐 3两端对齐
28、设置字体
Appword.Selection.FontName="宋体"
29、删除光标前面的字符(回车符等)
Appword.Selection.Typebackspace
30、删除字符
Appword.Selection.Delete(1,1) && 第一个数字:1为下删一字,2为下删到下一个标点 第二个数字为数量
31、插入新页
Appword.Selection.InsertBreak(0)
32、回车符
Appword.Selection.TypeParagraph  && 0--插入新页  1--插入分页符
33、移到上一页的页首
Appword.Selection.Browser.Previous
34、移到下一页的页首
Appword.Selection.Browser.Next
35、
Appword.Selection.MoveRight(3,1,1) && 第一个数字意思:3--移动一句,2--移动到上一个标点,1--移动一个字符
&& 第二个数字为移动的数量  第三个数字表示选中状态
36、
Appword.Selection.MoveLeft(3,1,1)
37、
Appword.Selection.Moveup(4,1,1)      && 第一个数字:4--移到上一段开头,5--向上移一行,7--翻一页(PageDown)  
&& 第三个数字表示选中状态
38、
Appword.Selection.MoveDown(5,1,1)      && 第一个数字:4--移到下一段开头,5--向下移一行,7--下翻一页(PageDown)  
&& 第三个数字表示选中状态
39、选中全部文字
Appword.Selection.Wholestory
40、插入表格
Appword..ActiveDocument.Table.Add(Appword.Selection.Range,9,6,1,0)  && 插入一个9行6列的表格。第三个数字0为没有网格线,1表示有网格线;第四个数字为1时表格自动调整列宽,行宽0时固定列宽,自动调整行宽
41、选定表格一行
Appword.Selection.SelectRow  
42、选定表格一列
Appword.Selection.SelectColumn
43、选定表格
Appword.Selection.Tables(1).Select
44、选定表格所在行高为0.77厘米
Appword.Selection. Tables(1).RowsHeight=0.77/0.035
45、选定表格所在列宽为2厘米
Appword.Selection.Tables(1).RowsHeight=2/0.035
46、
Appword.Selection. Tables(1).Rows.Alignment=1  && 0为选定表格居左,1时居中,2时居右
47、
Appword.Selection.Cells.VerticalAlignment=3   && 选定表格为上对齐,1为居中对齐,2为下对齐
48、
Appword.Selection.ParagraphFormat.Alignment=2  && 选定单元格0为左对齐,1为居中,2为右对齐
49、在第三行第三列插入文字
Appword.Selection.Tables(1).Row(3).Cell(3).Range.InsertAfter("中国")
50、将选中文字进行分栏操作
Appword.ActiveDocument.Range(Appword.Selection.Start,  Appword.Selection.Start).InsertBreak(3)  
51、插入图形
Appword.ActiveDocument.Shape.AddShapes(1,2/0.035,3/0.035,8/0.035,4/0.035) && 插入图形:第一个数字为图形形状,1为矩形,2为平行四边形,3为梯形,各word中基本图形一致,33为箭头总汇第一个,其他类推;第二个数字为图形距面左边位置;第三个数字为图形距面上边位置;第四个数字为图形宽度;第五个数字为图形高度
52、插入直线
Appword.ActiveDocument.Shapes.AddLine(6/0.035,6/0.035,6/0.035,9/0.035)  && 插入直线:前两个数字为起点距页面左、上坐标点,后两个数字为终点距页面左、上坐标点
53、线宽选择
Appword.Selection.ShapeRange.Line.Weight=0.05/0.035  && 线宽范围必须在选中状态下可用
54、线型选择
Appword.Selection.ShapeRange.Line.Dashstyle=1 && 线型可选择1--8,共8种
55、把第一行设置为标题行
WordTable.Rows(1).HeadingFormat=.t.
56、设置第一行高度为1厘米(10毫米)
WordTable.Rows(1).Height=10*2.835
57、设置框线类型
WordTable.Borders.Enable=1   && 0--无   1--实  2--其它...
58、设置单元格左间距
WordTable.LeftPadding=2*2.835
59、设置单元格右间距
WordTable.RightPadding=2*2.835
60、设置单元格上间距
WordTable.TopPadding=1*2.835
61、设置单元格下间距
WordTable.BottomPadding=1*2.835
62、表格水平居中
WordTable.Rows.HorizontalPosition= - 999995
63、用VFP调用Word模版文档
Objword=CreateObject("word.application")
Objword.Visible=.t.
Objword.Documents.Open("C:\Program Files\Microsoft office\Templates\2052\典雅型信函.dot",0)
64、VFP使用CreateObject命令实现对word文件进行操作的方法
Public oleApp
oleApp=CreateObject("word.application")
oleApp.Visible=.t.
oleApp.Documents.Add
oleApp.Selection.TypeText("欢迎光临word世界!")
oleApp.Documents(1).SaveAs("C:\test.doc")
oleApp.Quit
65、打印预览
Appword.ActiveDocument.PrintPreview
66、打印
Appword.ActiveDocument.PrintOut
67、为word文档添加一个表格
Appword.ActiveDocuments(1).Tables.Add(Appword.Selection.Range,1,1)
68、在表格的下面重新增加一个表格
Appword.Selection.MoveDown(5,2,.F.)   && 这里的“5”表示光标向下移动的单位,“2”表示移动的行数,“.F.”布尔型表示是否拓展式移动
Appword.Selection.TypeParagraph
Appword.ActiveDocument.Tables.Add(.Appword.Selection.Range,1,1)
69、拆分单元格
Appword.Documents(1).Tables(2).Cells(1,1).Select
Appword.Selection.Cells.Split(2,3,.F.)  && 将光标所涉及到的单元格的集合拆分成2行3列
OR:Appword.Documents(1).Tables(2).Cells(1,1).Split(2,3)
70、合并单元格
Appword.Documents(1).Tables(2).Cells(1,1).Select
Appword.Selection.MoveRight(1,3,.T.)  && 光标向右移动3个单位
Appword.Selection.Cells.Merge
71、 复制与粘贴
WordApp.Selection.Copy           &&& 复制
WordApp.Selection.paste          &&& 粘贴
72、修改书签的值
WordApp.ActiveDocument.Bookmarks.Item("班名").Range.Text=WordCellText   &&& Bookmarks 翻译为书签的名字复数,通过书签“班名”进行插入内容

只求每天有一丁点儿的进步就可以了
2018-01-10 15:10
王咸美
Rank: 1
等 级:新手上路
帖 子:579
专家分:0
注 册:2018-1-4
收藏
得分:0 
需要显示0
2018-01-10 16:27
schtg
Rank: 12Rank: 12Rank: 12
来 自:https://t.me/pump_upp
等 级:贵宾
威 望:67
帖 子:1545
专家分:3003
注 册:2012-2-29
收藏
得分:0 
回复 6楼 王咸美
正常输出就显示为0,只有不需要显示0时才处理哈。
图片附件: 游客没有浏览图片的权限,请 登录注册
2018-01-10 19:46
schtg
Rank: 12Rank: 12Rank: 12
来 自:https://t.me/pump_upp
等 级:贵宾
威 望:67
帖 子:1545
专家分:3003
注 册:2012-2-29
收藏
得分:0 
回复 5楼 wengjl
很全面的,谢谢!
2018-01-10 19:48
王咸美
Rank: 1
等 级:新手上路
帖 子:579
专家分:0
注 册:2018-1-4
收藏
得分:0 
能提供一个详细的dbf转word代码吗?急用!万分感谢帮忙!!!
2018-01-11 07:03
schtg
Rank: 12Rank: 12Rank: 12
来 自:https://t.me/pump_upp
等 级:贵宾
威 望:67
帖 子:1545
专家分:3003
注 册:2012-2-29
收藏
得分:0 
回复 9楼 王咸美
cfilename=sys(5)+sys(2003)+"\AA.doc"
WORDAPP=CREATEOBJECT("WORD.APPLICATION")
WORDAPP.DOCUMENTS.OPEN(cfilename)
WORDAPP.VISIBLE =.T.
&& 单元格循环 写入数据
WORDAPP.SELECTION.TABLES(1).CELL(nHnum,nLnum).RANGE.TEXT=Crl   && crl字符名
2018-01-12 08:22
快速回复:vfp的dbf写入word表格中数值0怎样显示
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016567 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved