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 线条样式

  • 相关阅读:
    Android(java)学习笔记68:使用proguard混淆android代码
    SGU 194 Reactor Cooling
    关于流量有上下界的网络流问题的求解
    关于最小割的求解方法
    HDU 5311 Hidden String
    POJ 3548 Restoring the digits
    POJ 2062 HDU 1528 ZOJ 2223 Card Game Cheater
    ZOJ 1967 POJ 2570 Fiber Network
    HDU 1969 Pie
    HDU 1956 POJ 1637 Sightseeing tour
  • 原文地址:https://www.cnblogs.com/hishanghai/p/2672598.html
Copyright © 2011-2022 走看看