粘贴Word文档表格格式错乱
ueditor吧
全部回复
仅看楼主
level 1
ejzhang 楼主
粘贴时:
提交后:
前端代码:
<form method="post" action="/ueditor/php/controller.php">
<script id="editor" name="editor" type="text/plain" style="width:800px;height:400px;"></script>
<input type="submit">
</form>
<script type="text/javascript">
var ue = UE.getEditor('editor', {
toolbars: [
......
],
focus: true,
wordCount: false,
elementPathEnabled: false,
autoHeightEnabled: false,
autoFloatEnabled: false,
allHtmlEnabled: true
});
</script>
后端代码:
echo $_POST['editor'];
2014年07月17日 09点07分 1
level 1
ejzhang 楼主
提交后,后端获取的代码如下,发现表格错乱的原因为:1、属性值的引号前添加了反斜线,2、表格(table)的border属性丢失,3、单元格(td)的style样式中添加了“border-top-style: none”、“border-bottom-style: none”、“border-left-style: none”、“border-right-style: none”等内容。
......
<p><span style=\"letter-spacing: 1px;\"><br clear=\"all\" style=\"page-break-before: always; text-align: left;\"/> </span> </p><p style=\"margin: 5px 0px; text-align: left;\">1.中汇总公司科技研究开发计划课题验收信息</p><table cel
lsp
acing=\"0\" cellpadding=\"0\"><tbody><tr style=\";height:19px\" class=\"firstRow\"><td width=\"103\" colspan=\"3\" style=\"border-width: 2px 1px 1px 2px; border-color: windowtext; padding: 0px 2px;\" height=\"19\"><p style=\"text-align: left; line-height: 27px;\">课题名称</p></td><td width=\"465\" colspan=\"13\" valign=\"top\" style=\"border-top-color: windowtext; border-top-width: 2px; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 2px; padding: 0px 2px;\" height=\"19\"><p style=\"line-height: 27px; text-align: left;\">综合管理部物资调配管理信息系统</p></td></tr><tr style=\";page-break-inside:avoid;height:22px\"><td width=\"103\" colspan=\"3\" style=\"border-top-style: none; border-left-color: windowtext; border-left-width: 2px; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px 2px;\" height=\"22\"><p style=\"text-align: left; line-height: 27px;\">项目计划编号</p></td><td width=\"124\" colspan=\"4\" valign=\"top\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px 2px;\" height=\"22\"><p style=\"line-height: 27px; text-align: left;\">2013CX39</p></td><td width=\"109\" colspan=\"3\" valign=\"top\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px 2px;\" height=\"22\"><p style=\"line-height: 27px; text-align: left;\">课题起止时间</p></td><td width=\"231\" colspan=\"6\" valign=\"top\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 2px; padding: 0px 2px;\" height=\"22\"><p style=\"line-height: 27px; text-align: left;\">2012.6---2013.12</p></td></tr><tr style=\";height:12px\"><td width=\"103\" colspan=\"3\" style=\"border-top-style: none; border-left-color: windowtext; border-left-width: 2px; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px 2px;\" height=\"12\"><p style=\"text-align: left;\">承担单位</p></td><td width=\"465\" colspan=\"13\" valign=\"top\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 2px; padding: 0px 2px;\" height=\"12\"><p style=\"text-align: left;\">综合管理部</p></td></tr><tr style=\";height:30px\"><td width=\"103\" colspan=\"3\" style=\"border-top-style: none; border-left-color: windowtext; border-left-width: 2px; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px 2px;\" height=\"30\"><p style=\"text-align: left; text-indent: 16px; line-height: 27px;\">参加单位</p></td><td width=\"465\" colspan=\"13\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 2px; padding: 0px 2px;\" height=\"30\"><p style=\"line-height: 27px; text-align: left;\">综合管理部</p></td></tr><tr style=\";page-break-inside:avoid;height:10px\"><td width=\"38\" rowspan=\"3\" style=\"border-top-style: none; border-left-color: windowtext; border-left-width: 2px; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px;\" height=\"10\"><p style=\"margin-top: 10px; text-align: left;\">课</p><p style=\"margin-top: 3px; text-align: left;\">题</p><p style=\"margin-top: 3px; text-align: left;\">负</p><p style=\"margin-top: 3px; text-align: left;\">责</p><p style=\"margin-top: 3px; text-align: left;\">人</p></td><td width=\"65\" colspan=\"2\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px;\" height=\"10\"><p style=\"text-align: left;\">姓名</p></td><td width=\"65\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px;\" height=\"10\"><p style=\"text-align: left;\">刘才山</p></td><td width=\"48\" colspan=\"2\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px;\" height=\"10\"><p style=\"text-align: left;\">学历</p></td><td width=\"84\" colspan=\"3\" valign=\"top\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px 7px;\" height=\"10\"><br style=\"text-align: left;\"/></td><td width=\"58\" colspan=\"2\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px 7px;\" height=\"10\"><p style=\"text-align: left;\">职称</p></td><td width=\"62\" colspan=\"2\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px;\" height=\"10\"><p style=\"text-align: left;\">工程师</p></td><td width=\"48\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 1px; padding: 0px 2px;\" height=\"10\"><p style=\"text-align: left;\">电话</p></td><td width=\"100\" colspan=\"2\" style=\"border-top-style: none; border-left-style: none; border-bottom-color: windowtext; border-bottom-width: 1px; border-right-color: windowtext; border-right-width: 2px; padding: 0px 7px;\" height=\"10\"><p style=\"text-align: left;\">xxxxxxxxxx</p></td></tr>
......
2014年07月18日 01点07分 2
level 1
正好我也在做这个 ueditor.all.js的10077-10079行注掉试试看,此段代码用来重新格式的
2014年07月29日 11点07分 3
多谢回复,这个问题我在后台将“\"”替换成“"”解决了,现在的问题是,UEditor中的表格提交后会丢失边框,有边框的表格全部变成无边框的了,请问这个如何解决?
2014年08月05日 02点08分
这个问题在UMEditor中不存在,但是UMEditor粘贴时编辑器高度会改变,破坏界面布局,这两个编辑器都无法正常使用,只要能解决一个问题就可以,谢谢!
2014年08月05日 02点08分
1