【问题标题】:HTML : How to force words separte with white space to break line if it's not fit in the cell?HTML:如果不适合单元格,如何强制用空格分隔的单词换行?
【发布时间】:2020-03-26 05:08:19
【问题描述】:

我在 Odoo Qweb 中做一些动态表格。
我使表格具有表格布局:固定;边框折叠:折叠和宽度:100%;
我想知道为什么“4 Colin Desmarets”不像“3 Colin Company”那样破产?
我尝试了很多可用的 css 样式,但无法得到我想要的 pdf 和 html 格式的结果。

这是我的 scss:

.table-main-report-dn {
width: 100%;
border-collapse: collapse;
table-layout: fixed;

tr, td {
    border: 1px solid black;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

td {
    padding: 4px;
}

td.name {
    width: 17%;
}

td.name-intra {
    width: 35%;
}

td.company {
    width: 33%;
}

td.birthday {
    height: 20%;
}

td.title {
    height: 44px;
    background-color: #EDEEE1;
}

td.text-title {
    vertical-align: baseline;
    text-align: center;
}

tr.main {
    td {
        height: 65px;
    }
}

td.main-info {
    height: 150px !important;
}

}

这是我的 xml 代码:

<tr t-foreach="o.participant_ids" t-as="participant" class="main">
                        <td>
                            <b><t t-esc="count"/>&#160;<t t-esc="participant.lastname"/>&#160;<t t-esc="participant.firstname"/>
                            </b>
                        </td>
                        <td>
                            <t t-esc="participant.parent_id.name"/>
                        </td>
                        <td>
                            <t t-if="participant.birth" t-esc="participant.birth.strftime('%d/%m/%Y')"/>
                        </td>
                        <t t-foreach="range(o.session_id.seance_count)" t-as="d">
                            <td></td>
                        </t>
                        <t t-set="count" t-value="count+1"/>
                    </tr>

你能帮帮我吗?

【问题讨论】:

  • 分词:断词;给你的 td
  • @ZiadDarwich,已经尝试过了,但不起作用。谢谢
  • 你能发布一个工作代码吗?
  • @ZiadDarwich,我的代码有效,但问题出在我的 css 中
  • 是的,我无法复制..

标签: html css odoo qweb


【解决方案1】:

如何避免使用不间断空格 (&amp;#160;)?

<t t-esc="count + ' ' + participant.lastname + ' ' + participant.firstname"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-12
    • 1970-01-01
    • 1970-01-01
    • 2015-05-13
    • 2011-04-20
    • 2011-10-03
    相关资源
    最近更新 更多