查看: 28|回复: 1

咨询管理yua可以实现一个datatable表格每一行生成一张表

升级   0.32%

2

主题

4

回帖

32

积分

注册会员

Rank: 2

积分
32
发表于 昨天 10:10 | 显示全部楼层 |阅读模式
可以实现一个datatable表格每一行生成一张表进行打印么

我有一个datatable表格,里面有40个字段,每行要对应一个审核表格进行打印,这样打印的话应该不算是批量打印了,而是一次性生成所有需要打印的审核表在一个文档,直接打印的话应该可以做到一个表格一张纸把,想问下管理大大这种的如何操作,如何把datatable中的数据赋值到打印模版中
回复

使用道具 举报

升级   0.85%

1

主题

7

回帖

85

积分

注册会员

Rank: 2

积分
85
发表于 昨天 10:49 | 显示全部楼层
可以搭配如下css使用,把你每一行的数据所在的div给指定为一个纸张


[CSS] 纯文本查看 复制代码
@page {
	margin: 0
}

body {
	margin: 0
}

.sheet {
	margin: 0;
	overflow: hidden;
	position: relative;
	box-sizing: border-box;
	page-break-after: always;
}

/** Paper sizes **/
body.A3 .sheet {
	width: 297mm;
	height: 419mm;
	box-sizing: border-box !important;
}

body.A3.landscape .sheet {
	width: 420mm;
	height: 296mm;
	box-sizing: border-box !important;
}

body.A4 .sheet {
	width: 210mm;
	height: 296mm;
	box-sizing: border-box !important;
}

body.A4.landscape .sheet {
	width: 297mm;
	height: 209mm;
	box-sizing: border-box !important;
}

body.A5 .sheet {
	width: 148mm;
	height: 209mm;
	box-sizing: border-box !important;
}

body.A5.landscape .sheet {
	width: 210mm;
	height: 147mm;
	box-sizing: border-box !important;
}

body.letter .sheet {
	width: 216mm;
	height: 279mm;
	box-sizing: border-box !important;
}

body.letter.landscape .sheet {
	width: 280mm;
	height: 215mm;
	box-sizing: border-box !important;
}

body.legal .sheet {
	width: 216mm;
	height: 356mm;
	box-sizing: border-box !important;
}

body.legal.landscape .sheet {
	width: 357mm;
	height: 215mm;
	box-sizing: border-box !important;
}

/** Padding area **/
.sheet.padding-10mm {
	padding: 10mm
}

.sheet.padding-15mm {
	padding: 15mm
}

.sheet.padding-20mm {
	padding: 20mm
}

.sheet.padding-25mm {
	padding: 25mm
}

/** For screen preview **/
@media screen {
	body {
		background: #e0e0e0
	}

	.sheet {
		background: white;
		box-shadow: 0 .5mm 2mm rgba(0, 0, 0, .3);
		margin: 5mm auto;
	}
}

/** Fix for Chrome issue #273306 **/
@media print {
	body.A3.landscape {
		width: 420mm
	}

	body.A3,
	body.A4.landscape {
		width: 297mm
	}

	body.A4,
	body.A5.landscape {
		width: 210mm
	}

	body.A5 {
		width: 148mm
	}

	body.letter,
	body.legal {
		width: 216mm
	}

	body.letter.landscape {
		width: 280mm
	}

	body.legal.landscape {
		width: 357mm
	}
}
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系客服 关注微信 下载APP 返回顶部 返回列表
viewthread