| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4522 人关注过本帖, 3 人收藏
标题:VFP导入EXCEL探讨
只看楼主 加入收藏
取消关键字高亮
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9831
专家分:27165
注 册:2012-2-5
收藏
得分:0 
回复 10楼 TonyDeng
再次表示十三亿分感谢

坚守VFP最后的阵地
2012-05-20 22:57
wengjl
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:109
帖 子:2203
专家分:3867
注 册:2007-4-27
收藏
得分:0 
慢慢地学习中……

只求每天有一丁点儿的进步就可以了
2012-05-21 08:28
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
你是不是想要类似下面这样的东西?

程序代码:
*** XlLineStyle枚举 -- 指定边框的线条样式
* 实线
#DEFINE xlContinuous       1
* 虚线
#DEFINE xlDash             -4115
* 点划相间线
#DEFINE xlDashDot          4
* 划线后跟两个点
#DEFINE xlDashDotDot       5
* 点式线
#DEFINE xlDot              -4118
* 双线
#DEFINE xlDouble           -4119
* 无线条
#DEFINE xlLineStyleNone    -4142
* 倾斜的划线
#DEFINE xlSlantDashDot     13
***

授人以渔,不授人以鱼。
2012-05-24 14:11
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
程序代码:
#INCLUDE "Const.h"

*--------------------
* Borders集合:由四个border对象组成的集合,他们分别代表Range或Style对象的四个边框
* 说明:使用Borders属性可返回包含所有四个边框的Borders集合。只能对Range和Style对象的各个边框分别设置
*       边框属性。其他带边框的对象(如误差线和系列线)不论边框有几个边,都将边框视为一个实体。对于这
*       些对象,在返回边框和设置边框属性时必须将其作为一个整体处理。
*
* 使用Borders(index)可返回单个Border对象,其中index指定边框。
* index常量列表:
*    xlDiagonalDown = 5         从区域中每个单元格的左上角至右下角的边框
*    xlDiagonalUp = 6           从区域中每个单元格的左下角至右上角的边框
*    xlEdgeTop = 7              区域左边的边框
*    xlEdgeTop = 8              区域顶部的边框
*    xlEdgeBottom = 9           区域底部的边框
*    xlEdgeRight = 10           区域右边的边框
*    xlInsideVertical = 11      区域中所有单元格的垂直边框(区域以外的边框除外)
*    xlInsideHorizontal = 12    区域中所有单元格的水平边框(区域以外的边框除外)
*
* Borders.LineStyle属性:返回或设置边框的线型。
* LineStyle取值常量列表:
*     xlContinuous = 1           实线
*     xlDash = -4115             虚线
*     xlDashDot = 4              点划相间线
*     xlDashDotDot = 5           划线后跟两个点
*     xlDot = -4118              点式线
*     xlDouble = -4119           双线
*     xlLineStyleNone = -4142    无线条
*     xlSlantDashDot = 13        倾斜的划线
*
* Borders.Weight属性:返回或设置一个xlBorderWeight值,它代表边框的粗细。
* Weight常量列表:
*     xlHairline = 1             细线(最细的边框)
*     xlMedium = -4138           中等
*     xlThick = 4                粗(最宽的边框)
*     xlThin = 2*
* XlColorIndex枚举:指定所选功能(如边框、字体或填充)的颜色。
* 常量列表:
*    xlColorIndexAutomatic = -4105    自动配色
*    xlColorIndexNone = -4142         无色
*--------------------

*---------------------
* 画 Excel 表的框格
* 参数:
*   o_Excel       -- Excel 表对象
*   c_LeftTop     -- 左上角单元
*   c_RightBottom -- 右下角单元
*---------------------
PROCEDURE DrawTableBorder(oExcel AS Object, cLeftTop AS Character, cRightBottom AS Character)

    WITH oExcel.ActiveSheet.Range(cLeftTop + ":" + cRightBottom)    && 激活指定的单元区域
        .Borders(xlDiagonalDown).LineStyle = xlNone
        .Borders(xlDiagonalUp).LineStyle = xlNone
        WITH .Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        ENDWITH
        WITH .BorderS(xlEdgeTop)
            .Linestyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        ENDWITH
        WITH .Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        ENDWITH
        WITH .Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        ENDWITH
        WITH .Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        ENDWITH
        WITH .Borders(xlInsideHorizontal)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        ENDWITH
        .Borders(xlDiagonalDown).LineStyle = xlNone
        .Borders(xlDiagonalUp).LineStyle = xlNone
        WITH .Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .Weight = xlMedium
            .ColorIndex = xlAutomatic
        ENDWITH
        WITH .Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .Weight = xlMedium
            .ColorIndex = xlAutomatic
        ENDWITH
        WITH .Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .Weight = xlMedium
            .ColorIndex = xlAutomatic
        ENDWITH
        WITH .Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .Weight = xlMedium
            .ColorIndex = xlAutomatic
        ENDWITH
        WITH .Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        ENDWITH
        WITH .Borders(xlInsideHorizontal)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        ENDWITH
    ENDWITH 

ENDPROC


[ 本帖最后由 TonyDeng 于 2012-5-25 01:53 编辑 ]

授人以渔,不授人以鱼。
2012-05-24 16:07
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9831
专家分:27165
注 册:2012-2-5
收藏
得分:0 
回复 10楼 TonyDeng
再次谢谢TONGDENG版主的无私奉献

坚守VFP最后的阵地
2012-05-24 21:46
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9831
专家分:27165
注 册:2012-2-5
收藏
得分:0 
回复 14楼 TonyDeng
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 双线
出生年月  身份证号  .....................................
───────────────────────────── 单细线
表头下面的这条“单细线”如何画,不是表中内容下的水平线

坚守VFP最后的阵地
2012-05-24 23:53
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
程序代码:
        WITH .Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        ENDWITH


这个就是底部单细线:线型是连续实线,粗细为细,颜色自动。视情形可以去掉颜色设置的代码,它默认就是自动。

其实,我上面那个代码,就是分别对区域的外框顶、左、下、右、中横、中竖分别设置线条,令外框是粗线,里面细线。代码是从Excel宏中黏贴过来的(即在Excel手工操作时它就是按这个代码执行),这样写看起来效率不高(有些地方是重复的),但我在没有仔细研究Excel指令体系的时候,一直没有对它动手术,就让它这样了,因为首先保证它是不会错的。你可以对它进行修改、测试,摸索出效率更高的代码,总之,基础就是上面那一大堆注释。

[ 本帖最后由 TonyDeng 于 2012-5-25 00:07 编辑 ]

授人以渔,不授人以鱼。
2012-05-24 23:56
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9831
专家分:27165
注 册:2012-2-5
收藏
得分:0 
THANK YOU
xlEdgeBotton==xlEdgeBottom?
那个写法是正确的
xlEdgeBotton = 9
xlEdgeBottom = ?

[ 本帖最后由 sdta 于 2012-5-25 00:13 编辑 ]

坚守VFP最后的阵地
2012-05-25 00:03
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
总之,上面注释所写的三种属性,对每一条边线都可以组合使用,得到各种不同的效果,所以集中写在一起。也可以不对整个borders操作,分别对单个单元格设置,想怎么样都行。

授人以渔,不授人以鱼。
2012-05-25 00:06
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9831
专家分:27165
注 册:2012-2-5
收藏
得分:0 
xlEdgeBotton==xlEdgeBottom?
那个写法是正确的
xlEdgeBotton = 9
xlEdgeBottom = ?

坚守VFP最后的阵地
2012-05-25 01:29
快速回复:VFP导入EXCEL探讨
数据加载中...
 
   



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

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