87,984
社区成员
发帖
与我相关
我的任务
分享
case 'width':
if(tag ==='<table'){
n[i]="width:400px";
}
continue;
//注释掉return function ( html )中的if
//if ( isWordDocument( html ) ) {
html = filterPasteWord( html );
//}
但是表格宽度不变?
我用这个表格测试的(有两处不同的table width):
<table width="1800" bordercolor="#003366" style="width: 1000px;height:300px;">
<tr>
<td>11</td>
<td width="900" height="60">12</td>
</tr>
<tr width="1900" height="70">
<td>21</td>
<td>22</td>
</tr>
</table>
审查元素是这样:
<table width="1800" bordercolor="#003366" style="font-size:15px;line-height:22px;height:300px">
没有变成期望的style="width: 800px;"switch ( name ) {
case "mso-padding-alt":
case "mso-padding-top-alt":
case "mso-padding-right-alt":
case "mso-padding-bottom-alt":
case "mso-padding-left-alt":
case "mso-margin-alt":
case "mso-margin-top-alt":
case "mso-margin-right-alt":
case "mso-margin-bottom-alt":
case "mso-margin-left-alt":
//ie下会出现挤到一起的情况
// case "mso-table-layout-alt":
case "mso-height":
case "mso-width":
case "mso-vertical-align-alt":
//trace:1819 ff下会解析出padding在table上
if(!/<table/.test(tag))
n[i] = name.replace( /^mso-|-alt$/g, "" ) + ":" + ensureUnits( value );
continue;
case "horiz-align":
n[i] = "text-align:" + value;
continue;
case "vert-align":
n[i] = "vertical-align:" + value;
continue;
case "font-color":
case "mso-foreground":
n[i] = "color:" + value;
continue;
case "mso-background":
case "mso-highlight":
n[i] = "background:" + value;
continue;
case "mso-default-height":
n[i] = "min-height:" + ensureUnits( value );
continue;
case "mso-default-width":
n[i] = "min-width:" + ensureUnits( value );
continue;
case "mso-padding-between-alt":
n[i] = "border-collapse:separate;border-spacing:" + ensureUnits( value );
continue;
case "text-line-through":
if ( (value == "single") || (value == "double") ) {
n[i] = "text-decoration:line-through";
}
continue;
//trace:1870
// //word里边的字体统一干掉
// case 'font-family':
// continue;
case "mso-zero-height":
if ( value == "yes" ) {
n[i] = "display:none";
}
continue;
case 'width':
if(tag ==='<table'){
n[i]="width:800px";
}
continue;
case 'margin':
if ( !/[1-9]/.test( parts[1] ) ) {
continue;
}
}
return function ( html ) {
//过了word,才能转p->li
first = null;
parentTag = '',liStyle = '',firstTag = '';
//if ( isWordDocument( html ) ) {
html = filterPasteWord( html );
//}
return html.replace( />[ \t\r\n]*</g, '><' );
};
不好意思,周末不看csdn
switch ( name ) {
case "mso-padding-alt":
case "mso-padding-top-alt":
case "mso-padding-right-alt":
case "mso-padding-bottom-alt":
case "mso-padding-left-alt":
case "mso-margin-alt":
case "mso-margin-top-alt":
case "mso-margin-right-alt":
case "mso-margin-bottom-alt":
case "mso-margin-left-alt":
//ie下会出现挤到一起的情况
// case "mso-table-layout-alt":
case "mso-height":
case "mso-width":
case "mso-vertical-align-alt":
//trace:1819 ff下会解析出padding在table上
if(!/<table/.test(tag))
n[i] = name.replace( /^mso-|-alt$/g, "" ) + ":" + ensureUnits( value );
continue;
case "horiz-align":
n[i] = "text-align:" + value;
continue;
case "vert-align":
n[i] = "vertical-align:" + value;
continue;
case "font-color":
case "mso-foreground":
n[i] = "color:" + value;
continue;
case "mso-background":
case "mso-highlight":
n[i] = "background:" + value;
continue;
case "mso-default-height":
n[i] = "min-height:" + ensureUnits( value );
continue;
case "mso-default-width":
n[i] = "min-width:" + ensureUnits( value );
continue;
case "mso-padding-between-alt":
n[i] = "border-collapse:separate;border-spacing:" + ensureUnits( value );
continue;
case "text-line-through":
if ( (value == "single") || (value == "double") ) {
n[i] = "text-decoration:line-through";
}
continue;
//trace:1870
// //word里边的字体统一干掉
// case 'font-family':
// continue;
case "mso-zero-height":
if ( value == "yes" ) {
n[i] = "display:none";
}
continue;
case 'margin':
if ( !/[1-9]/.test( parts[1] ) ) {
continue;
}
}
return function ( html ):
return function ( html ) {
//过了word,才能转p->li
first = null;
parentTag = '',liStyle = '',firstTag = '';
if ( isWordDocument( html ) ) {
html = filterPasteWord( html );
}
return html.replace( />[ \t\r\n]*</g, '><' );
};