网站建设 百科,html网页设计大作业,google推广怎么做,微信公众号api接口一、实践发现了bug和不足 今天用了公文一键排版系统对几个PDF文件格式的材料进行文字识别后再重新排版#xff0c;处理效果还是相当不错的#xff0c;节约了不少的时间。
但是也发现了三个需要改进的地方#xff1a;
#xff08;一#xff09;发现了两个bug#xff1a;…一、实践发现了bug和不足 今天用了公文一键排版系统对几个PDF文件格式的材料进行文字识别后再重新排版处理效果还是相当不错的节约了不少的时间。
但是也发现了三个需要改进的地方
一发现了两个bug 1.二级标题排版格式中css的text-indent属性的单位忘记从em改为pt结果排版时二级标题显示几乎变成居中了。 2.存储温馨提示信息的变量a初始值设为null结果在输出a时null也被当成字符串符显示了应设为为。 这两个均已debug了。
二文字识别经常将标点符号识别为半角的符号排版出来不够美观。
三文字识别会添加一些空格排版出来不够美观。
二、明确了改进方向
针对上面发现的不足决定给一键排版系统增加两项功能 半角标点符号和全角标点符号相互转换的功能按钮。 删除空格的的功能按钮
三、实现半角标点符号和全角标点符号相互转换
先实现上面列的第1项功能。
在网上搜索了一下已经有网友做过分析并分享了实现这个功能的代码。
拥有全角与半角之分的ASCII字符范围0x20~0x7E。
除了空格0x20外其他的字符中全角与半角均相差0xFFE0。全角空格的代码为0x03000 。
因此在全角与半角的字符转换中除空格需要特殊处理外
全角 半角 0xFEE0
半角 全角 - 0xFFE0
半角字符的代码范围
在网友们分享的代码基础上做了一点改进。
!DOCTYPE HTML
HTML
headmeta http-equivContent-Type contenttext/html; charsetutf-8 /meta nameAuthor contentPurpleEndurertitle公文一键排版系统/title
/head
body
fieldset stylewidth: 1100px;legend实时编辑区/legendiframe ideditor width1200px height400px styleborder: solid 1px;/iframe
/fieldset
p全角和半角字符转换input typebutton idbtnHalf2Full value半角转全角 onclickedRichBody.innerTexthalf2Full(edRichBody.innerText) stylebackground:blue; color:white; border-radius: 25px; /input typebutton idbtnFull2Half value全角转半角 onclickedRichBody.innerTextfull2Half(edRichBody.innerText) stylebackground:green; color:white; border-radius: 25px; /
/pscriptconst edRich document.getElementById(editor);
var edRichDoc;
var edRichBody;if (typeof(edRich) ! undefined){edRichDoc edRich.contentWindow.document;edRichDoc.designMode on;edRichDoc.contentEditable true;edRichBody edRichDoc.body;edRichBody.innerHTML pa hrefhttp://blog.csdn.net/purpleendurerhttp://blog.csdn.net/purpleendurer/a/pp/pp stylefont-family:方正小标宋简体;font-size:22pt; text-align:center; line-height:28pt;p aligncenter styletext-align:center;text-indent:24.0pt;line-height:28.0ptspan langEN-US stylefont-size:22.0pt;font-family:方正小标宋简体;mso-hansi-font-family:黑体;color:blackSQL/spanspan stylefont-size:22.0pt;font-family:方正小标宋简体;mso-hansi-font-family:黑体;color:black注入基础span langEN-USo:p/o:p/span/span/pp styletext-indent:2em;河池市××局、 市×× 局 /pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxspan stylefont-size:16.0pt;font-family:黑体;color:black一、span langEN-USSQL/span注入分类span langEN-USo:p/o:p/span/span/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxbspan stylefont-size:16.0pt;font-family:楷体_GB2312;color:black一什么是span langEN-USSQL/span注入span langEN-US?o:p/o:p/span/span/b/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxspan langEN-US stylefont-size:16.0pt;font-family:仿宋_GB2312;color:blackSLQ/spanspan stylefont-size:16.0pt;font-family:仿宋_GB2312;color:black注入span langEN-US(/span英文span langEN-US: Sqlinject)/span当span langEN-USweb/span应用向后台数据库传递span langEN-USSQL/span语句进行数据库操作时如果对用户输入的参数没有经过严格的过滤那么用户可以构造特殊的span langEN-USsq1/span语句从而带入到数据库中执行获取或修改数据库中的数据。span langEN-USo:p/o:p/span/span/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxspan stylefont-size:16.0pt;color:blacknbsp;nbsp;1.加强技术学习。一要span langEN-USo:p/o:p/span/span/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0pxspan stylefont-size:16.0pt;color:blacknbsp;nbsp;2.强化安全保障。一要。span langEN-USo:p/o:p/span/span/pp附件河池市××关于××××××××××××××××××××××××××××××××××××××××××××××××××的通知/pp附件:河池市××关于××的通知/pp附件河池市××关于××的通知。/pp附件1.河池市××关于××的通 知/pp附件1河池市××关于××××的通 知 /pp2河池市××关于×× ××的通 知 /pp3河池市××关于×× ××的通 知/pp测试1/pp styletext-indent:24.0pt;line-height:28.0pt;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px河池市××××局/pp2023年7月22日/pp测试2/pp广西壮族自治区河池市××××局/pp2023年7月22日/pp测试3/pp河池市××局/pp2023年7月22日/pp测试4/pp河池市×局/pp2023年7月22日/pp附件/pp附件标题/pp附件/pp附件标题/pp附 件/pp附件标题/p;
}
else
{window.alert(undefined);
} //功能半角字符转全角字符
//输入p待转换的字符串
//输出转换后的字符串
//更新20230803创建
function half2Full(p)
{var r ; //resultfor (var i 0; i p.length; i){var c p.charCodeAt(i);if (c 0x0021 c 0x007E){if (c0x0020) //处理空格{c 0x03000;}else{//全角与半角相差除空格外65248(十进制)c 65248;}}//ifr String.fromCharCode(c);}//forreturn r;
}//half2Full(p)//功能全角字符转半角字符
//输入p待转换的字符串
//输出转换后的字符串
//更新20230803创建
function full2Half(p)
{var r ; //resultfor(var i 0; i p.length; i){var c p.charCodeAt(i);if (c 0xFF01 c 0xFF5E){if (c0x03000) //处理空格{c 0x0020;}else{ //全角与半角相差除空格外65248十进制c - 65248;}//if}r String.fromCharCode(c);}//for
//alert(r);return r;
}//full2Half(p) /script
/body
/html
效果如下图 下一步我们将增加一些转换选项比如英文字母、阿拉伯数字、标点符号、空格。