maroto icon indicating copy to clipboard operation
maroto copied to clipboard

m.Text 自动换行,对中文没有支持

Open xijaja opened this issue 2 years ago • 4 comments

我尝试使用下面的代码,但其实,只有英文自动换行:

m.Row(130, func() {
		m.Col(12, func() {
			text1 := "此工廠診斷報告僅供給工廠作改善依據,不做任何長霉風險判定及究責。工廠診斷所收集的\n數據、資料及圖片僅代表當天的狀況,不代表工廠平日的生產數據、管控情形,工廠端須以\n品牌客戶的標準為指標,本著降低長霉風險及製造良好產品的精神,自主做好工廠各方面的\n控制與管理。"
			text2 := "This factory audit report is only for the improvement of factory and does not make any mold risk judgment and accountability. The data, information and pictures are all collected by the factory audit only, represent the situation of the day, do not represent the production data and control situation of the factory on weekdays. The factory must follow the brand standard to reduce the risk of mold growth and produce good quality products, and independently control and manage all aspects of the factory."
			m.Text(text1+text2, props.Text{
				Size:  12,
				Top:   10,
				Align: consts.Left,
				// Extrapolate:     false,
				VerticalPadding: 2.0,
			})
		})
	})

不论我是否在 text1 的字符串中添加“\n”,结果都是只有英文自动换行; 并且,如果我仅使用 text1 结果也是一样,它并不会自动换行,您可以尝试一下。

xijaja avatar May 26 '22 15:05 xijaja

在 TableList 的单元格中,中午也无法实现自动换行,如果使用中文+英文的形式,那么还将造成单元格高度不会自动调整。

xijaja avatar May 28 '22 04:05 xijaja

那么,如何才能让中文也能在单元格中自动换行呢?🤔

xijaja avatar May 28 '22 04:05 xijaja

I'm afraid that maroto doesn't support \n to wrap text, if somehow it supports, is not the idea yet. There is a lost pull request #207 which seems to add support to this, but it's not ready yet.

johnfercher avatar May 28 '22 15:05 johnfercher

any update on this fr?

syssam avatar Sep 07 '22 04:09 syssam

is this the same issue as #221?

johnfercher avatar Sep 19 '23 18:09 johnfercher

is this the same issue as #221?

Yes, it's the same.

xijaja avatar Sep 20 '23 02:09 xijaja

Thanks for the answer. I will close this one, since the #221 is already addressed.

johnfercher avatar Sep 20 '23 02:09 johnfercher