zoukankan      html  css  js  c++  java
  • C#设置EXCEL 单元格格式

    C#设置EXCEL单元格格式

    数字(Range.NumberFormatlocal 属性)
    常规: Range.NumberFormatlocal =
    "G/通用格式"
    数值:Range.NumberFormatlocal = "0.000_" --保留小数位数为3 (此处“_”表示:留下一个与下一个字符同等宽度的空格)


    Range.NumberFormatlocal = "0"
    --不要小数


    Range.NumberFormatlo cal =
    "#,##0.000" --保留小数位数为3,并使用千位分隔符
    货币:Range.NumberFormatlocal =
    "$#,##0.000"
    百分比:Range.NumberFormatlocal =
    "0.000%"
    分数:Range.NumberFormatlocal = "# ?/?"
    科学计数:Range.NumberFormatlocal
    = "0.00E+00"
    文本: Range.NumberFormatlocal = "@"
    特殊:Range.NumberFormatlocal
    = "000000"---邮政编码
        Range.NumberFormatlocal =
    "[DBNum1]G/通用格式"---中文小写数字
        Range.NumberFormatlocal =
    "[DBNum2]G/通用格式"---中文大写数字
        Range.NumberFormatlocal =
    "[DBNum2][$RMB]G/通用格式"---人民币大写
    对齐
    水平对齐:Range.HorizontalAlignment =
    etHAlignCenter ---居中
    垂 直对齐:Range.VerticalAlignment =
    etVAlignCenter---居中
    是否自动换行:Range.WrapText =
    True
    是否缩小字体填充:Range.ShrinkToFit = True
    是否合并单元格:Range.MergeCells =
    False
    文字竖排:Range.Orientation = etVertical
    文字倾斜度数:Range.Orientation = 45
    -----倾斜45度
    字体(Font对象)
    字体名称:Font.Name = "华文行楷"
    字形: Font.FontStyle =
    "常规"
    字号:Font.Size = "10"
    下划线:Font.Strikethrough = True; Font.Underline =
    etUnderlineStyleDouble ---双下划线
    上标:Font.Superscript = True

    标:Font.SubScript = True
    删除线:Font.OutlineFont =
    True
    边框(Borders对象)
    Borders.Item(etEdgeTop):上边框
    Borders.Item(etEdgeLeft):左边框
    Borders.Item
    (etEdgeRight):右边框
    Borders.Item(etEdgeBottom):下边框
    Borders.Item(etDiagonalDown)
    :左上--右下边框
    Borders.Item(etDiagonalUp):左下--右上边框
    Border.LineStyle =
    etContinuous 线条样式

  • 相关阅读:
    centos6.3 配置防火墙,开启80端口、3306端口
    Unable to run man pages on Centos 6
    1. 信息系统基础知识
    2. 软件工程
    CommonJs
    软考资料
    Node.js资料
    qyqt5(一)
    tf源码中的object_detection_tutorial.ipynb文件
    分类结果的评价指标
  • 原文地址:https://www.cnblogs.com/hishanghai/p/2672598.html
Copyright © 2011-2022 走看看