五千年(敝帚自珍)

主题:【说明】在帖中实现“表格”功能的方式。 -- 铁手

共:💬15 🌺15
分页树展主题 · 全看首页 上页
/ 1
下页 末页
  • 家园 【说明】在帖中实现“表格”功能的方式。

    有很多朋友提到过希望在帖中能够有表格功能。以前没有简单的实现方式。现在想了一个变通的方法,可以实现简单的表格功能。

    在发帖界面里,有一个【代码】按钮。用这个功能,就可以实现简单的表格。

    表格内容的对齐用空格来实现。举 3行 4列 的表格例子如下:

    aaaaa bbbb cccc dddd

    第二排 二一 二三 二四

    第三排 三二 三三 三四

    对齐方式会因为字体的问题而出现对齐不整。

    把内容放到 [CODE ][ /CODE] 的 ][ 中间。

    aaaaa     bbbb   cccc   dddd
    第二排    二一   二三   二四
    第三排    三二   三三   三四
    

    对齐方式相对好看一些。

    提示:输入时候的对齐和最后显示的对齐会有差异,请发帖后自己查看,并做适当空格的调整。

    通宝推:leqian,

    本帖一共被 1 帖 引用 (帖内工具实现)
    • 家园 用全角方式就能保证对齐

      比如下面老铁的帖子,在我这里就没有对齐。我用的是adobe 黑体,可能和大家不太一样。

      我看还是一律用中文全角字体,比如:

            保加利亚    捷克   民主德国

          ———————————————————

      1989  44.1  89.3  119.0

      1992  35.6  81.6   74.2

       增长率 -19.4  -8.5  -37.7

      大家看怎么样?

      上面没有使用竖线,需要的话可以用字母I。不过只要留出相应空间,不加竖线更美观,学术文章一般都不加竖线。

      • 家园 如果一定要用竖线的话,全角字符集中也有。

        ┌───────┬───────┬───────┐

        │中文   │aBc  │123  ┃

        ├───────┼───────┼───────┤

        │     │     │     │

        └───────┴───────┴───────┘

         但这样字符(包括空格)与制表符的宽度还是不一样,这里面每格字符是五个,制表符的─是七个。

        ┌----┬----┬--------┐

        │中文  │aBc │        │

        ├----┼----┼--------┤

        │    │    │12345678│

        ├----┼----┼--------┤

        │    │QWE │123     │

        └----┴----┴--------┘

        这里是用全角字符中的“-”,就是0和=之间的那个代替了制表符─。

    • 家园 再测试

      ----------------------------

      ++++++++++++++++++++++++++++

      ____________________________

      ============================

      !!!!!!!!!!!!!!!!!!!!!!!!!!!!

      @@@@@@@@@@@@@@@@@@@@@@@@@@@@

      ############################

      $$$$$$$$$$$$$$$$$$$$$$$$$$$$

      %%%%%%%%%%%%%%%%%%%%%%%%%%%%

      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

      &&&&&&&&&&&&&&&&&&&&&&&&&&&&

      1111111111111111111111111111

      2222222222222222222222222222

      3333333333333333333333333333

      4444444444444444444444444444

      5555555555555555555555555555

      6666666666666666666666666666

      7777777777777777777777777777

      8888888888888888888888888888

      9999999999999999999999999999

      0000000000000000000000000000

      ||||||||||||||||||||||||||||

      aaaaaaaaaaaaaaaaaaaaaaaaaaaa

      AAAAAAAAAAAAAAAAAAAAAAAAAAAA

      bbbbbbbbbbbbbbbbbbbbbbbbbbbb

      BBBBBBBBBBBBBBBBBBBBBBBBBBBB

      cccccccccccccccccccccccccccc

      CCCCCCCCCCCCCCCCCCCCCCCCCCCC

      dddddddddddddddddddddddddddd

      DDDDDDDDDDDDDDDDDDDDDDDDDDDD

      eeeeeeeeeeeeeeeeeeeeeeeeeeee

      EEEEEEEEEEEEEEEEEEEEEEEEEEEE

      ffffffffffffffffffffffffffff

      FFFFFFFFFFFFFFFFFFFFFFFFFFFF

      gggggggggggggggggggggggggggg

      GGGGGGGGGGGGGGGGGGGGGGGGGGGG

      hhhhhhhhhhhhhhhhhhhhhhhhhhhh

      HHHHHHHHHHHHHHHHHHHHHHHHHHHH

      iiiiiiiiiiiiiiiiiiiiiiiiiiii

      IIIIIIIIIIIIIIIIIIIIIIIIIIII

      jjjjjjjjjjjjjjjjjjjjjjjjjjjj

      JJJJJJJJJJJJJJJJJJJJJJJJJJJJ

      kkkkkkkkkkkkkkkkkkkkkkkkkkkk

      KKKKKKKKKKKKKKKKKKKKKKKKKKKK

      llllllllllllllllllllllllllll

      LLLLLLLLLLLLLLLLLLLLLLLLLLLL

      mmmmmmmmmmmmmmmmmmmmmmmmmmmm

      MMMMMMMMMMMMMMMMMMMMMMMMMMMM

      nnnnnnnnnnnnnnnnnnnnnnnnnnnn

      NNNNNNNNNNNNNNNNNNNNNNNNNNNN

      oooooooooooooooooooooooooooo

      OOOOOOOOOOOOOOOOOOOOOOOOOOOO

      pppppppppppppppppppppppppppp

      PPPPPPPPPPPPPPPPPPPPPPPPPPPP

      qqqqqqqqqqqqqqqqqqqqqqqqqqqq

      QQQQQQQQQQQQQQQQQQQQQQQQQQQQ

      rrrrrrrrrrrrrrrrrrrrrrrrrrrr

      RRRRRRRRRRRRRRRRRRRRRRRRRRRR

      ssssssssssssssssssssssssssss

      SSSSSSSSSSSSSSSSSSSSSSSSSSSS

      tttttttttttttttttttttttttttt

      TTTTTTTTTTTTTTTTTTTTTTTTTTTT

      uuuuuuuuuuuuuuuuuuuuuuuuuuuu

      UUUUUUUUUUUUUUUUUUUUUUUUUUUU

      vvvvvvvvvvvvvvvvvvvvvvvvvvvv

      VVVVVVVVVVVVVVVVVVVVVVVVVVVV

      wwwwwwwwwwwwwwwwwwwwwwwwwwww

      WWWWWWWWWWWWWWWWWWWWWWWWWWWW

      xxxxxxxxxxxxxxxxxxxxxxxxxxxx

      XXXXXXXXXXXXXXXXXXXXXXXXXXXX

      yyyyyyyyyyyyyyyyyyyyyyyyyyyy

      YYYYYYYYYYYYYYYYYYYYYYYYYYYY

      zzzzzzzzzzzzzzzzzzzzzzzzzzzz

      ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

      ----------------------------

      ++++++++++++++++++++++++++++

      ____________________________

      ============================

      !!!!!!!!!!!!!!!!!!!!!!!!!!!!

      @@@@@@@@@@@@@@@@@@@@@@@@@@@@

      ############################

      $$$$$$$$$$$$$$$$$$$$$$$$$$$$

      %%%%%%%%%%%%%%%%%%%%%%%%%%%%

      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

      &&&&&&&&&&&&&&&&&&&&&&&&&&&&

      1111111111111111111111111111

      2222222222222222222222222222

      3333333333333333333333333333

      4444444444444444444444444444

      5555555555555555555555555555

      6666666666666666666666666666

      7777777777777777777777777777

      8888888888888888888888888888

      9999999999999999999999999999

      0000000000000000000000000000

      ||||||||||||||||||||||||||||

      aaaaaaaaaaaaaaaaaaaaaaaaaaaa

      AAAAAAAAAAAAAAAAAAAAAAAAAAAA

      bbbbbbbbbbbbbbbbbbbbbbbbbbbb

      BBBBBBBBBBBBBBBBBBBBBBBBBBBB

      cccccccccccccccccccccccccccc

      CCCCCCCCCCCCCCCCCCCCCCCCCCCC

      dddddddddddddddddddddddddddd

      DDDDDDDDDDDDDDDDDDDDDDDDDDDD

      eeeeeeeeeeeeeeeeeeeeeeeeeeee

      EEEEEEEEEEEEEEEEEEEEEEEEEEEE

      ffffffffffffffffffffffffffff

      FFFFFFFFFFFFFFFFFFFFFFFFFFFF

      gggggggggggggggggggggggggggg

      GGGGGGGGGGGGGGGGGGGGGGGGGGGG

      hhhhhhhhhhhhhhhhhhhhhhhhhhhh

      HHHHHHHHHHHHHHHHHHHHHHHHHHHH

      iiiiiiiiiiiiiiiiiiiiiiiiiiii

      IIIIIIIIIIIIIIIIIIIIIIIIIIII

      jjjjjjjjjjjjjjjjjjjjjjjjjjjj

      JJJJJJJJJJJJJJJJJJJJJJJJJJJJ

      kkkkkkkkkkkkkkkkkkkkkkkkkkkk

      KKKKKKKKKKKKKKKKKKKKKKKKKKKK

      llllllllllllllllllllllllllll

      LLLLLLLLLLLLLLLLLLLLLLLLLLLL

      mmmmmmmmmmmmmmmmmmmmmmmmmmmm

      MMMMMMMMMMMMMMMMMMMMMMMMMMMM

      nnnnnnnnnnnnnnnnnnnnnnnnnnnn

      NNNNNNNNNNNNNNNNNNNNNNNNNNNN

      oooooooooooooooooooooooooooo

      OOOOOOOOOOOOOOOOOOOOOOOOOOOO

      pppppppppppppppppppppppppppp

      PPPPPPPPPPPPPPPPPPPPPPPPPPPP

      qqqqqqqqqqqqqqqqqqqqqqqqqqqq

      QQQQQQQQQQQQQQQQQQQQQQQQQQQQ

      rrrrrrrrrrrrrrrrrrrrrrrrrrrr

      RRRRRRRRRRRRRRRRRRRRRRRRRRRR

      ssssssssssssssssssssssssssss

      SSSSSSSSSSSSSSSSSSSSSSSSSSSS

      tttttttttttttttttttttttttttt

      TTTTTTTTTTTTTTTTTTTTTTTTTTTT

      uuuuuuuuuuuuuuuuuuuuuuuuuuuu

      UUUUUUUUUUUUUUUUUUUUUUUUUUUU

      vvvvvvvvvvvvvvvvvvvvvvvvvvvv

      VVVVVVVVVVVVVVVVVVVVVVVVVVVV

      wwwwwwwwwwwwwwwwwwwwwwwwwwww

      WWWWWWWWWWWWWWWWWWWWWWWWWWWW

      xxxxxxxxxxxxxxxxxxxxxxxxxxxx

      XXXXXXXXXXXXXXXXXXXXXXXXXXXX

      yyyyyyyyyyyyyyyyyyyyyyyyyyyy

      YYYYYYYYYYYYYYYYYYYYYYYYYYYY

      zzzzzzzzzzzzzzzzzzzzzzzzzzzz

      ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

      [QUOTE]

      ----------------------------
      ++++++++++++++++++++++++++++
      ____________________________
      ============================
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!
      @@@@@@@@@@@@@@@@@@@@@@@@@@@@
      ############################
      $$$$$$$$$$$$$$$$$$$$$$$$$$$$
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      &&&&&&&&&&&&&&&&&&&&&&&&&&&&
      1111111111111111111111111111
      2222222222222222222222222222
      3333333333333333333333333333
      4444444444444444444444444444
      5555555555555555555555555555
      6666666666666666666666666666
      7777777777777777777777777777
      8888888888888888888888888888
      9999999999999999999999999999
      0000000000000000000000000000
      ||||||||||||||||||||||||||||
      aaaaaaaaaaaaaaaaaaaaaaaaaaaa
      AAAAAAAAAAAAAAAAAAAAAAAAAAAA
      bbbbbbbbbbbbbbbbbbbbbbbbbbbb
      BBBBBBBBBBBBBBBBBBBBBBBBBBBB
      cccccccccccccccccccccccccccc
      CCCCCCCCCCCCCCCCCCCCCCCCCCCC
      dddddddddddddddddddddddddddd
      DDDDDDDDDDDDDDDDDDDDDDDDDDDD
      eeeeeeeeeeeeeeeeeeeeeeeeeeee
      EEEEEEEEEEEEEEEEEEEEEEEEEEEE
      ffffffffffffffffffffffffffff
      FFFFFFFFFFFFFFFFFFFFFFFFFFFF
      gggggggggggggggggggggggggggg
      GGGGGGGGGGGGGGGGGGGGGGGGGGGG
      hhhhhhhhhhhhhhhhhhhhhhhhhhhh
      HHHHHHHHHHHHHHHHHHHHHHHHHHHH
      iiiiiiiiiiiiiiiiiiiiiiiiiiii
      中中中中中中中中中中中中中中
      IIIIIIIIIIIIIIIIIIIIIIIIIIII
      jjjjjjjjjjjjjjjjjjjjjjjjjjjj
      JJJJJJJJJJJJJJJJJJJJJJJJJJJJ
      kkkkkkkkkkkkkkkkkkkkkkkkkkkk
      KKKKKKKKKKKKKKKKKKKKKKKKKKKK
      llllllllllllllllllllllllllll
      LLLLLLLLLLLLLLLLLLLLLLLLLLLL
      mmmmmmmmmmmmmmmmmmmmmmmmmmmm
      MMMMMMMMMMMMMMMMMMMMMMMMMMMM
      nnnnnnnnnnnnnnnnnnnnnnnnnnnn
      NNNNNNNNNNNNNNNNNNNNNNNNNNNN
      oooooooooooooooooooooooooooo
      OOOOOOOOOOOOOOOOOOOOOOOOOOOO
      pppppppppppppppppppppppppppp
      PPPPPPPPPPPPPPPPPPPPPPPPPPPP
      qqqqqqqqqqqqqqqqqqqqqqqqqqqq
      QQQQQQQQQQQQQQQQQQQQQQQQQQQQ
      rrrrrrrrrrrrrrrrrrrrrrrrrrrr
      RRRRRRRRRRRRRRRRRRRRRRRRRRRR
      ssssssssssssssssssssssssssss
      SSSSSSSSSSSSSSSSSSSSSSSSSSSS
      tttttttttttttttttttttttttttt
      TTTTTTTTTTTTTTTTTTTTTTTTTTTT
      uuuuuuuuuuuuuuuuuuuuuuuuuuuu
      UUUUUUUUUUUUUUUUUUUUUUUUUUUU
      vvvvvvvvvvvvvvvvvvvvvvvvvvvv
      VVVVVVVVVVVVVVVVVVVVVVVVVVVV
      wwwwwwwwwwwwwwwwwwwwwwwwwwww
      WWWWWWWWWWWWWWWWWWWWWWWWWWWW
      xxxxxxxxxxxxxxxxxxxxxxxxxxxx
      XXXXXXXXXXXXXXXXXXXXXXXXXXXX
      yyyyyyyyyyyyyyyyyyyyyyyyyyyy
      YYYYYYYYYYYYYYYYYYYYYYYYYYYY
      zzzzzzzzzzzzzzzzzzzzzzzzzzzz
      ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

      [/QUOTE]

      [QUOTE]----------------------------
      ++++++++++++++++++++++++++++
      ____________________________
      ============================
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!
      @@@@@@@@@@@@@@@@@@@@@@@@@@@@
      ############################
      $$$$$$$$$$$$$$$$$$$$$$$$$$$$
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      &&&&&&&&&&&&&&&&&&&&&&&&&&&&
      1111111111111111111111111111
      2222222222222222222222222222
      3333333333333333333333333333
      4444444444444444444444444444
      5555555555555555555555555555
      6666666666666666666666666666
      7777777777777777777777777777
      8888888888888888888888888888
      9999999999999999999999999999
      0000000000000000000000000000
      ||||||||||||||||||||||||||||
      aaaaaaaaaaaaaaaaaaaaaaaaaaaa
      AAAAAAAAAAAAAAAAAAAAAAAAAAAA
      bbbbbbbbbbbbbbbbbbbbbbbbbbbb
      中中中中中中中中中中中中中中
      BBBBBBBBBBBBBBBBBBBBBBBBBBBB
      cccccccccccccccccccccccccccc
      CCCCCCCCCCCCCCCCCCCCCCCCCCCC
      dddddddddddddddddddddddddddd
      DDDDDDDDDDDDDDDDDDDDDDDDDDDD
      eeeeeeeeeeeeeeeeeeeeeeeeeeee
      EEEEEEEEEEEEEEEEEEEEEEEEEEEE
      ffffffffffffffffffffffffffff
      FFFFFFFFFFFFFFFFFFFFFFFFFFFF
      gggggggggggggggggggggggggggg
      GGGGGGGGGGGGGGGGGGGGGGGGGGGG
      hhhhhhhhhhhhhhhhhhhhhhhhhhhh
      HHHHHHHHHHHHHHHHHHHHHHHHHHHH
      iiiiiiiiiiiiiiiiiiiiiiiiiiii
      IIIIIIIIIIIIIIIIIIIIIIIIIIII
      jjjjjjjjjjjjjjjjjjjjjjjjjjjj
      JJJJJJJJJJJJJJJJJJJJJJJJJJJJ
      kkkkkkkkkkkkkkkkkkkkkkkkkkkk
      KKKKKKKKKKKKKKKKKKKKKKKKKKKK
      llllllllllllllllllllllllllll
      LLLLLLLLLLLLLLLLLLLLLLLLLLLL
      mmmmmmmmmmmmmmmmmmmmmmmmmmmm
      MMMMMMMMMMMMMMMMMMMMMMMMMMMM
      nnnnnnnnnnnnnnnnnnnnnnnnnnnn
      NNNNNNNNNNNNNNNNNNNNNNNNNNNN
      oooooooooooooooooooooooooooo
      OOOOOOOOOOOOOOOOOOOOOOOOOOOO
      pppppppppppppppppppppppppppp
      PPPPPPPPPPPPPPPPPPPPPPPPPPPP
      qqqqqqqqqqqqqqqqqqqqqqqqqqqq
      QQQQQQQQQQQQQQQQQQQQQQQQQQQQ
      rrrrrrrrrrrrrrrrrrrrrrrrrrrr
      RRRRRRRRRRRRRRRRRRRRRRRRRRRR
      ssssssssssssssssssssssssssss
      SSSSSSSSSSSSSSSSSSSSSSSSSSSS
      tttttttttttttttttttttttttttt
      TTTTTTTTTTTTTTTTTTTTTTTTTTTT
      uuuuuuuuuuuuuuuuuuuuuuuuuuuu
      UUUUUUUUUUUUUUUUUUUUUUUUUUUU
      vvvvvvvvvvvvvvvvvvvvvvvvvvvv
      VVVVVVVVVVVVVVVVVVVVVVVVVVVV
      wwwwwwwwwwwwwwwwwwwwwwwwwwww
      WWWWWWWWWWWWWWWWWWWWWWWWWWWW
      xxxxxxxxxxxxxxxxxxxxxxxxxxxx
      XXXXXXXXXXXXXXXXXXXXXXXXXXXX
      yyyyyyyyyyyyyyyyyyyyyyyyyyyy
      YYYYYYYYYYYYYYYYYYYYYYYYYYYY
      zzzzzzzzzzzzzzzzzzzzzzzzzzzz
      ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ[/QUOTE]
      ----------------------------
      ++++++++++++++++++++++++++++
      ____________________________
      ============================
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!
      @@@@@@@@@@@@@@@@@@@@@@@@@@@@
      ############################
      $$$$$$$$$$$$$$$$$$$$$$$$$$$$
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      &&&&&&&&&&&&&&&&&&&&&&&&&&&&
      1111111111111111111111111111
      2222222222222222222222222222
      3333333333333333333333333333
      4444444444444444444444444444
      5555555555555555555555555555
      6666666666666666666666666666
      7777777777777777777777777777
      8888888888888888888888888888
      9999999999999999999999999999
      0000000000000000000000000000
      ||||||||||||||||||||||||||||
      aaaaaaaaaaaaaaaaaaaaaaaaaaaa
      AAAAAAAAAAAAAAAAAAAAAAAAAAAA
      bbbbbbbbbbbbbbbbbbbbbbbbbbbb
      BBBBBBBBBBBBBBBBBBBBBBBBBBBB
      cccccccccccccccccccccccccccc
      CCCCCCCCCCCCCCCCCCCCCCCCCCCC
      dddddddddddddddddddddddddddd
      DDDDDDDDDDDDDDDDDDDDDDDDDDDD
      eeeeeeeeeeeeeeeeeeeeeeeeeeee
      EEEEEEEEEEEEEEEEEEEEEEEEEEEE
      ffffffffffffffffffffffffffff
      FFFFFFFFFFFFFFFFFFFFFFFFFFFF
      gggggggggggggggggggggggggggg
      GGGGGGGGGGGGGGGGGGGGGGGGGGGG
      hhhhhhhhhhhhhhhhhhhhhhhhhhhh
      HHHHHHHHHHHHHHHHHHHHHHHHHHHH
      iiiiiiiiiiiiiiiiiiiiiiiiiiii
      中中中中中中中中中中中中中中
      IIIIIIIIIIIIIIIIIIIIIIIIIIII
      jjjjjjjjjjjjjjjjjjjjjjjjjjjj
      JJJJJJJJJJJJJJJJJJJJJJJJJJJJ
      kkkkkkkkkkkkkkkkkkkkkkkkkkkk
      KKKKKKKKKKKKKKKKKKKKKKKKKKKK
      llllllllllllllllllllllllllll
      LLLLLLLLLLLLLLLLLLLLLLLLLLLL
      mmmmmmmmmmmmmmmmmmmmmmmmmmmm
      MMMMMMMMMMMMMMMMMMMMMMMMMMMM
      nnnnnnnnnnnnnnnnnnnnnnnnnnnn
      NNNNNNNNNNNNNNNNNNNNNNNNNNNN
      oooooooooooooooooooooooooooo
      OOOOOOOOOOOOOOOOOOOOOOOOOOOO
      pppppppppppppppppppppppppppp
      PPPPPPPPPPPPPPPPPPPPPPPPPPPP
      qqqqqqqqqqqqqqqqqqqqqqqqqqqq
      QQQQQQQQQQQQQQQQQQQQQQQQQQQQ
      rrrrrrrrrrrrrrrrrrrrrrrrrrrr
      RRRRRRRRRRRRRRRRRRRRRRRRRRRR
      ssssssssssssssssssssssssssss
      SSSSSSSSSSSSSSSSSSSSSSSSSSSS
      tttttttttttttttttttttttttttt
      TTTTTTTTTTTTTTTTTTTTTTTTTTTT
      uuuuuuuuuuuuuuuuuuuuuuuuuuuu
      UUUUUUUUUUUUUUUUUUUUUUUUUUUU
      vvvvvvvvvvvvvvvvvvvvvvvvvvvv
      VVVVVVVVVVVVVVVVVVVVVVVVVVVV
      wwwwwwwwwwwwwwwwwwwwwwwwwwww
      WWWWWWWWWWWWWWWWWWWWWWWWWWWW
      xxxxxxxxxxxxxxxxxxxxxxxxxxxx
      XXXXXXXXXXXXXXXXXXXXXXXXXXXX
      yyyyyyyyyyyyyyyyyyyyyyyyyyyy
      YYYYYYYYYYYYYYYYYYYYYYYYYYYY
      zzzzzzzzzzzzzzzzzzzzzzzzzzzz
      ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

        后三组中使用了[COLOR=red]

      [/COLOR][COLOR=red]

      [/COLOR],其中第一组“代码”框在“引用”里面,第二组“代码”框在“引用”外面,第三组只用了“代码”。

        其中中文字数=西文字符数/2

        用了“代码”西文字符自己可以对齐了,中文还没法与西文对齐。

        看来用了“代码”“引用”的字符串被显示出来了。

      • 家园 上面的测试说明:

          测试中每行字符数相同,显示长度不同。

          除了阿拉伯数字以外,其他字符在显示时每个字符占的宽度都不一样,看上去也不成数字比较小的比例(1:2、 1:3、 2:3等),所以靠改变字符数没法对的非常齐,

          相对全角字符:

        ------------------

        ==================

        __________________

        ++++++++++++++++++

        iiiiiiiiiiiiiiiiii

        IIIIIIIIIIIIIIIIII

        llllllllllllllllll

        LLLLLLLLLLLLLLLLLL

        甲甲甲甲甲甲甲甲甲甲甲甲甲甲甲甲甲甲

        乙乙乙乙乙乙乙乙乙乙乙乙乙乙乙乙乙乙

        ------------------

        ==================

        __________________

        ++++++++++++++++++

        iiiiiiiiiiiiiiiiii

        IIIIIIIIIIIIIIIIII

        llllllllllllllllll

        LLLLLLLLLLLLLLLLLL

        甲甲甲甲甲甲甲甲甲甲甲甲甲甲甲甲甲甲

        乙乙乙乙乙乙乙乙乙乙乙乙乙乙乙乙乙乙

          可保完全对齐。

          还有个问题:在发帖框内打字时,不管是什么字符都能对得很齐,里面是严格两个半角字符以应一个汉字。

          老铁能不能把显示时的字符也设置成发帖框内的方式,这样就容易对齐了。

    • 家园 测试:90年代初东欧电力工业数据

      表一、年最高负荷(百万千瓦)

      -------+------+------+------+------+------+------+------
             |  保  |  捷  | 民德 |  匈  |  波  |  罗  |  乌  
      -------+------+------+------+------+------+------+------
      1989年 |   8.3|  13.9|  18.3|   6.6|  24.3|  11.3|  42.6
      1992年 |   7.2|  12.0|  12.7|   5.6|  21.5|   9.6|  37.8
      增长率 |  -3.7| -13.3| -30.5| -13.9| -11.4| -15.0| -12.0
      -------+------+------+------+------+------+------+------

      表二、年发电量(10亿千瓦时)

      -------+------+------+------+------+------+------+------
             |  保  |  捷  | 民德 |  匈  |  波  |  罗  |  乌  
      -------+------+------+------+------+------+------+------
      1989年 |  44.1|  89.3| 119.0|  29.2| 145.5|  75.6| 310.1
      1992年 |  35.6|  81.6|  74.2|  31.3| 132.8|  54.1| 250.9
      增长率 | -19.4|  -8.5| -37.7|  +7.2|  -8.7| -28.4| -19.1
      -------+------+------+------+------+------+------+------

      表三、年用电量(10亿千瓦时)

      -------+------+------+------+------+------+------+------
             |  保  |  捷  | 民德 |  匈  |  波  |  罗  |  乌  
      -------+------+------+------+------+------+------+------
      1989年 |  48.6|  91.9| 120.1|  40.3| 147.3|  83.4| 277.8
      1992年 |  38.3|  82.1|  72.9|  34.8| 128.8|  58.3| 246.3
      增长率 | -21.2| -10.7| -39.3| -13.7| -12.6| -28.4| -11.4
      -------+------+------+------+------+------+------+------
      • 家园 不好意思,大家还是得自己加空格来对齐

        这个功能,是保证大家加的空格可以对齐。比如这个例子

        -------+--------+------+--------+------+-------+-------+------+
               |保加利亚| 捷克 |民主德国|匈牙利| 波兰 |罗马尼亚|乌克兰|
        -------+--------+------+--------+------+------+-------+------+
        1989年 | 44.1   | 89.3 |119.0   | 29.2 |145.5 | 75.6  |310.1 |
        1992年 | 35.6   | 81.6 | 74.2   | 31.3 |132.8 | 54.1  |250.9 |
        增长率 |-19.4   | -8.5 |-37.7   | +7.2 | -8.7 |-28.4  |-19.1 |
        
    • 家园 试一下
      var1    var2     var3
      长三    12       三米八
      短五    10       零点二
      
    • 家园 试试

      aaaa bbbb cccc dddd

      第一 第二 第三 第四

      aa bb cc dd

      第一 第二 第三 第四

      12 34 56 78

      1234 5678 9101 1213

      • 试试
        家园 看来对不齐的原因是英文(包括半角数字)的显示宽度不一样。

          要想严格对齐,就得全部用汉字字库,就是字母和数字也得用汉字字库的,就是所谓全角字符

    • 家园 学习了!!!
    • 家园 有宝

      恭喜:你意外获得【通宝】一枚

      鲜花已经成功送出,可通过工具取消

      提示:此次送花为此次送花为【有效送花赞扬,涨乐善、声望】。

    • 家园 学习ing!
分页树展主题 · 全看首页 上页
/ 1
下页 末页


有趣有益,互惠互利;开阔视野,博采众长。
虚拟的网络,真实的人。天南地北客,相逢皆朋友

Copyright © cchere 西西河