POI操作OFFICE转HTML
由于项目需求,需要上传在线预览生成的office文件,经过一番痛苦的研究,目前已经成功将DOC、DOCX、PPTX不乱码转换成功,PPT当字体不是宋体时出现乱码,至今无法解决,待日后再研究吧。而EXCEL转换未能解决图片问题。能力有限,先上代码吧
POI jar的maven地址:需注意的时,统一版本jar可能却会出现内部一些方法不存在,不明白什么情况,经测试,选择了3.15
<properties>
<poi.version>3.15</poi.version>
</properties>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-excelant</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
</exclusion>
</exclusions>
</dependency>
java代码如下:
package com.boco.investment.common; import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.poi.hslf.usermodel.HSLFAutoShape;
import org.apache.poi.hslf.usermodel.HSLFTable;
import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
import org.apache.poi.hslf.usermodel.HSLFTextRun;
import org.apache.poi.hssf.converter.ExcelToHtmlConverter;
import org.apache.poi.hssf.usermodel.HSSFPictureData;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.converter.WordToHtmlConverter;
import org.apache.poi.hwpf.usermodel.Picture;
import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.sl.usermodel.SlideShow;
import org.apache.poi.sl.usermodel.SlideShowFactory;
import org.apache.poi.xslf.usermodel.*;
import org.apache.poi.xwpf.converter.core.BasicURIResolver;
import org.apache.poi.xwpf.converter.core.FileImageExtractor;
import org.apache.poi.xwpf.converter.xhtml.XHTMLConverter;
import org.apache.poi.xwpf.converter.xhtml.XHTMLOptions;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.List; /**
* Created by wdj on 2017/11/14.
*
* 通过poi将doc、docx、ppt、pptx转为html
* 保存图片的位置在文件所在目录,以文件名创建文件夹下
*/
public class PoiUtils { private static Logger logger = LoggerFactory.getLogger(PoiUtils.class); private static String rootPath = ConfigUtils.getProperty("upload.rootPath"); private static final String IMAGE_SERVER = ConfigUtils.getProperty("file.server"); /**
* poi office文件转html,支持doc,docx,ppt,pptx
* 根据源文件在同一目录下生成相同名称的html文件
*/
public static boolean officeToHtml(String filePath) {
filePath = rootPath + filePath;
String htmlFilePath = FileUtils.getFileNameWithoutExtension(filePath)+".html";
try {
if(checkFile(filePath,"doc")){
return wordToHtml03(filePath,htmlFilePath);
}else if(checkFile(filePath,"docx")){
return wordToHtml07(filePath,htmlFilePath);
}else if(checkFile(filePath,"ppt")){
return pptToHtml03(filePath,htmlFilePath);
}else if(checkFile(filePath,"pptx")){
return pptToHtml07(filePath,htmlFilePath);
}else {
logger.error("poi OfficeToHtml出错,不支持的文件格式");
return false;
}
} catch (Exception e) {
logger.error("poi OfficeToHtml出错:",e);
return false;
}
} /**
* Word03 转为 HTML
*
* @param fileName
* @param outputFile
*/
public static boolean wordToHtml03(String fileName, String outputFile){
if (!(checkFile(fileName,"doc")||checkFile(fileName,"docx"))) {
logger.error("word03文件转html出错,不支持类型为:"+fileName.substring(fileName.lastIndexOf("."))+" 的文件");
return false;
}
HWPFDocument wordDoc = null;
WordToHtmlConverter wthc = null;
try {
wordDoc = new HWPFDocument(new FileInputStream(fileName));
wthc = new WordToHtmlConverter(
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument());
} catch (Exception e) {
logger.error("word03转html失败",e);
return false;
}
//html引用图片位置
wthc.setPicturesManager((bytes,pt,string,f,f1) ->getImageUrl(fileName)+string);
wthc.processDocument(wordDoc);
List<Picture> pics = wordDoc.getPicturesTable().getAllPictures();
fileExists(getImageSavePath(fileName));
if (null != pics && pics.size() > 0) {
for (Picture pic : pics) {
try {
//生成图片位置
pic.writeImageContent(new FileOutputStream(getImageSavePath(fileName)+pic.suggestFullFileName()));
} catch (IOException e) {
logger.error("word03转html失败",e);
return false;
}
}
}
Document htmlDocument = wthc.getDocument();
ByteArrayOutputStream out = new ByteArrayOutputStream();
DOMSource domSource = new DOMSource(htmlDocument);
StreamResult streamResult = new StreamResult(out); try {
TransformerFactory tf = TransformerFactory.newInstance();
Transformer serializer = tf.newTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
serializer.setOutputProperty(OutputKeys.METHOD, "html");
serializer.transform(domSource, streamResult);
} catch (TransformerException e) {
logger.error("word03转html失败",e);
return false;
} finally {
try {
out.close();
} catch (IOException e) {
logger.error("word03转html文件流关闭失败",e);
}
}
String htmlStr = new String(out.toByteArray());
return writeFile(htmlStr, outputFile);
} /**
* Word07 转为 HTML
*
* @param fileName
* @param outputFile
*/
public static boolean wordToHtml07(String fileName, String outputFile){
if (!checkFile(fileName,"docx")) {
logger.error("word07文件转html出错,不支持类型为:"+fileName.substring(fileName.lastIndexOf("."))+" 的文件");
return false;
}
//读取文档内容
XWPFDocument document = null;
try {
InputStream in = new FileInputStream(fileName);
document = new XWPFDocument(in);
} catch (IOException e) {
logger.error("word07转html失败",e);
return false;
}
//加载html页面时图片路径
XHTMLOptions options = XHTMLOptions.create().URIResolver( new BasicURIResolver(getImageUrl(fileName)));
//图片保存文件夹路径
fileExists(getImageSavePath(fileName));
options.setExtractor(new FileImageExtractor(new File(getImageSavePath(fileName))));
OutputStream out = null;
try {
out = new FileOutputStream(new File(outputFile));
XHTMLConverter.getInstance().convert(document, out, options);
return true;
} catch (IOException e) {
logger.error("word07转html失败",e);
return false;
} finally {
try {
out.close();
} catch (IOException e) {
logger.error("word07转html文件流关闭失败",e);
}
}
} /**
* excel to html
* @param path
* @param file
*/
// todo 待完成
public static void testExcel(String path,String file) {
HSSFWorkbook excelBook= null;
ExcelToHtmlConverter excelToHtmlConverter = null;
try {
InputStream input=new FileInputStream(path+file);
excelBook = new HSSFWorkbook(input);
excelToHtmlConverter = new ExcelToHtmlConverter(DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument() );
} catch (IOException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} //加载html页面时图片路径
XHTMLOptions options = XHTMLOptions.create().URIResolver( new BasicURIResolver(getImageUrl(path)));
//图片保存文件夹路径
options.setExtractor(new FileImageExtractor(new File(getImageSavePath(path))));
excelToHtmlConverter.setOutputRowNumbers(false);
excelToHtmlConverter.setOutputHiddenRows(false);
excelToHtmlConverter.setOutputColumnHeaders(false);
excelToHtmlConverter.setOutputHiddenColumns(true);
excelToHtmlConverter.processWorkbook(excelBook);
List pics = excelBook.getAllPictures();
if (pics != null) {
for (int i = 0; i < pics.size(); i++) {
HSSFPictureData pic = (HSSFPictureData) pics.get (i);
try {
// pic.writeImageContent (new FileOutputStream (path + pic.suggestFullFileName() ) );
new FileOutputStream (path + "11" ).write(pic.getData());
} catch (IOException e) {
e.printStackTrace();
} }
}
Document htmlDocument =excelToHtmlConverter.getDocument();
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
DOMSource domSource = new DOMSource (htmlDocument);
StreamResult streamResult = new StreamResult (outStream);
TransformerFactory tf = TransformerFactory.newInstance();
try {
Transformer serializer = tf.newTransformer();
serializer.setOutputProperty (OutputKeys.ENCODING, "utf-8");
serializer.setOutputProperty (OutputKeys.INDENT, "yes");
serializer.setOutputProperty (OutputKeys.METHOD, "html");
serializer.transform (domSource, streamResult);
} catch (TransformerException e) {
e.printStackTrace();
} finally {
try {
outStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
String content = new String (outStream.toByteArray() ); try {
FileUtils.writeStringToFile(new File (path, "exportExcel.html"), content, "utf-8");
} catch (IOException e) {
e.printStackTrace();
}
} /**
* ppt03转html
* filepath:源文件
* htmlname:生成html名称
* */
public static boolean pptToHtml03(String filepath, String outputFile){
File file = new File(filepath);
// 读入PPT文件
if (!checkFile(filepath,"ppt")) {
logger.error("ppt03文件转html出错,不支持类型为:"+FileUtils.getFileExtension(filepath)+" 的文件");
return false;
}
FileInputStream is = null;
SlideShow ppt;
try {
is = new FileInputStream(file);
ppt = SlideShowFactory.create(is);
} catch (IOException e) {
logger.error("ppt03文件转html出错:",e);
return false;
} finally {
try {
is.close();
} catch (IOException e) {
logger.error("ppt03文件转html关闭文件流失败:",e);
}
} Dimension pgsize = ppt.getPageSize();
List<Slide> slide = ppt.getSlides();
FileOutputStream out =null;
String imghtml="";
//保存图片位置
fileExists(getImageSavePath(filepath));
for (int i = 0; i < slide.size(); i++) {
for (Object o : slide.get(i).getShapes()) {
if(o instanceof HSLFAutoShape) {
HSLFAutoShape shapes = (HSLFAutoShape)o;
List<HSLFTextParagraph> list = shapes.getTextParagraphs();
for (HSLFTextParagraph hslfTextRuns : list) {
for (HSLFTextRun hslfTextRun : hslfTextRuns.getTextRuns()) {
hslfTextRun.setFontFamily("宋体");
}
}
}else if(o instanceof HSLFTable){
HSLFTable hslfTable = (HSLFTable) o;
int rowSize = hslfTable.getNumberOfRows();
int columnSize = hslfTable.getNumberOfColumns();
for (int j = 0; j < rowSize; j++) {
for (int k = 0; k < columnSize; k++) {
for (int l =0;l < hslfTable.getCell(j, k).getTextParagraphs().size();l++){
HSLFTextParagraph hslfTextRuns = hslfTable.getCell(j, k).getTextParagraphs().get(l);
for (int m = 0;m < hslfTextRuns.getTextRuns().size();m++){
HSLFTextRun textRun = hslfTextRuns.getTextRuns().get(m);
//todo 设置字体失败,输出html依旧会乱码
textRun.setFontFamily("宋体");
}
}
}
}
}
}
BufferedImage img = new BufferedImage(pgsize.width,pgsize.height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics();
graphics.setPaint(Color.BLUE);
graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));
slide.get(i).draw(graphics);
// 这里设置图片的存放路径和图片的格式(jpeg,png,bmp等等),注意生成文件路径与源文件同一个目录
try {
out= new FileOutputStream(getImageSavePath(filepath)+(i + 1) + ".jpeg");
javax.imageio.ImageIO.write(img, "jpeg", out);
} catch (IOException e) {
logger.error("ppt03文件转html出错:",e);
try {
out.close();
} catch (IOException e1) {
logger.error("ppt03文件转html关闭文件流失败:",e);
}
return false;
}
//图片在html加载路径
String imgs=getImageUrl(filepath)+(i + 1) + ".jpeg";
imghtml+="<img src=\'"+imgs+"\' style=\'width:1200px;height:830px;vertical-align:text-bottom;\'><br><br><br><br>"; }
DOMSource domSource = new DOMSource();
StreamResult streamResult = new StreamResult(out);
TransformerFactory tf = TransformerFactory.newInstance();
try {
Transformer serializer = tf.newTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "utf-8");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
serializer.setOutputProperty(OutputKeys.METHOD, "html");
serializer.transform(domSource, streamResult);
} catch (TransformerException e) {
logger.error("ppt03文件转html出错:",e);
return false;
} finally {
try {
out.close();
} catch (IOException e) {
logger.error("ppt03文件转html关闭文件流失败:",e);
}
} String ppthtml="<html><head><META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>"+imghtml+"</body></html>";
try {
FileUtils.writeStringToFile(new File(outputFile), ppthtml, "utf-8");
} catch (IOException e) {
logger.error("ppt03文件转html出错:",e);
return false;
}
return true;
} /**
* ppt07转html
* filepath:源文件
* outputFile:生成html名称
* */
public static boolean pptToHtml07(String filepath,String outputFile) {
File file = new File(filepath);
// 读入PPT文件
if (!checkFile(filepath,"pptx")) {
logger.error("ppt07文件转html出错,不支持类型为:"+FileUtils.getFileExtension(filepath)+" 的文件");
return false;
}
FileInputStream is = null;
SlideShow ppt;
try {
is = new FileInputStream(file);
ppt = SlideShowFactory.create(is);
} catch (IOException e) {
logger.error("ppt07文件转html出错:",e);
return false;
} finally {
try {
is.close();
} catch (IOException e) {
logger.error("ppt07文件转html关闭文件流失败:",e);
}
}
Dimension pgsize = ppt.getPageSize();
List<XSLFSlide> pptPageXSLFSLiseList=ppt.getSlides();
FileOutputStream out=null;
String imghtml="";
//保存图片位置
fileExists(getImageSavePath(filepath));
for (int i = 0; i < pptPageXSLFSLiseList.size(); i++) {
for(XSLFShape shape : pptPageXSLFSLiseList.get(i).getShapes()){
//设置文字字体
if(shape instanceof XSLFTextShape) {
XSLFTextShape tsh = (XSLFTextShape)shape;
for(XSLFTextParagraph p : tsh){
for(XSLFTextRun r : p){
r.setFontFamily("宋体");
}
}
//设置表格字体
}else if(shape instanceof XSLFTable){
XSLFTable table = (XSLFTable)shape;
int rowSize = table.getNumberOfRows();
int columnSize = table.getNumberOfColumns();
for (int j = 0; j < rowSize; j++) {
for (int k = 0; k < columnSize; k++) {
for (int l =0;l < table.getCell(j, k).getTextParagraphs().size();l++){
XSLFTextParagraph xslfTextRuns = table.getCell(j, k).getTextParagraphs().get(l);
for (int m = 0;m < xslfTextRuns.getTextRuns().size();m++){
xslfTextRuns.getTextRuns().get(m).setFontFamily("宋体");
}
}
}
}
}
}
BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
graphics.setPaint(Color.white);
graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));
pptPageXSLFSLiseList.get(i).draw(graphics);
//设置图片存放位置
String Imgname = getImageSavePath(filepath) + (i+1) + ".jpg";
try {
out = new FileOutputStream(Imgname);
javax.imageio.ImageIO.write(img, "jpg", out);
} catch (java.io.IOException e) {
logger.error("ppt07文件转html出错:",e);
try {
out.close();
} catch (IOException e1) {
logger.error("ppt07文件转html关闭流出错:",e);
}
return false;
}
//图片在html加载路径
String imgs=getImageUrl(filepath)+(i + 1) + ".jpg";
imghtml+="<img src=\'"+imgs+"\' style=\'width:1200px;height:830px;vertical-align:text-bottom;\'><br><br><br><br>";
} DOMSource domSource = new DOMSource();
StreamResult streamResult = new StreamResult(out);
TransformerFactory tf = TransformerFactory.newInstance();
try {
Transformer serializer = tf.newTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "utf-8");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
serializer.setOutputProperty(OutputKeys.METHOD, "html");
serializer.transform(domSource, streamResult);
} catch (TransformerException e) {
logger.error("ppt07文件转html出错:",e);
return false;
}finally {
try {
out.close();
} catch (java.io.IOException e) {
logger.error("ppt07文件转html关闭流出错:",e);
return false;
}
} String ppthtml="<html><head><META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>"+imghtml+"</body></html>";
try {
FileUtils.writeStringToFile(new File(outputFile), ppthtml, "utf-8");
return true;
} catch (Exception e) {
logger.error("ppt07文件转html关闭流出错:",e);
return false;
}
} /**
* 输出文件流
* @param content
* @param path
* @return
*/
public static boolean writeFile(String content, String path){
FileOutputStream fos = null;
BufferedWriter bw = null; File file = new File(path); try {
fos = new FileOutputStream(file);
bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
bw.write(content);
return true;
} catch (java.io.IOException e) {
logger.error("输出文件出错",e);
return false;
}finally {
try {
if (null != bw) {
bw.close();
}
if (null != fos) {
fos.close();
}
} catch (java.io.IOException e) {
logger.error("输出文件关闭流出错",e);
}
}
} /**
* 判断文件夹是否存在,不存在则新建
* @param path
*/
private static void fileExists(String path) {
File file = new File(path);
if (!file.exists()){
file.mkdirs();
}
} /**
* 检查文件类型
* @param fileName
* @return
*/
public static boolean checkFile(String fileName,String type) {
boolean flag = false;
String suffixname = FileUtils.getFileExtension(fileName);
if (suffixname != null && suffixname.equalsIgnoreCase(type)) {
flag = true;
}
return flag;
} /**
* 根据文件全路径获取文件所在路径
* @param fileFullName
* @return
*/
public static String getFilePath(String fileFullName) {
File file = new File(fileFullName);
String filePath = fileFullName.replace(file.getName(),"");
return filePath;
} private static String getImageUrl(String filePath){
filePath = filePath.replace(rootPath,"");
//图片引用地址需要去掉 rootpath
return IMAGE_SERVER+FileUtils.getFileNameWithoutExtension(filePath)+"/";
} private static String getImageSavePath(String filePath){
return FileUtils.getFileNameWithoutExtension(filePath)+File.separator;
} }
POI操作OFFICE转HTML的更多相关文章
- apache poi操作office文档----java在线预览txt、word、ppt、execel,pdf代码
在页面上显示各种文档中的内容.在servlet中的逻辑 word: BufferedInputStream bis = null; URL url = null; HttpURLConnectio ...
- poi操作excel2007(读取、生成、编辑)
因为现在再写excel2003版的比较low,所以我在这就不介绍了,直接介绍2007,我所用的编程软件是IDEA poi操作office总共有6个jar包,在pom.xml文件中配置如下,也可下载后直 ...
- 全面了解POI操作Microsoft Office(Word、Excel、PowerPoint)
POI 与 Microsoft Office 1. POI 简介 POI 是 Apache 下的 Jakata 项目的一个子项目,主要用于提供 java 操作 Microsoft Office 办公套 ...
- JAVA的POI操作Excel
1.1Excel简介 一个excel文件就是一个工作簿workbook,一个工作簿中可以创建多张工作表sheet,而一个工作表中包含多个单元格Cell,这些单元格都是由列(Column)行(Row)组 ...
- Java操作word文档使用JACOB和POI操作word,Excel,PPT需要的jar包
可参考文档: http://wibiline.iteye.com/blog/1725492 下载jar包 http://download.csdn.net/download/javashixiaofe ...
- java使用POI操作XWPFDocument中的XWPFRun(文本)对象的属性详解
java使用POI操作XWPFDocument中的XWPFRun(文本)对象的属性详解 我用的是office word 2016版 XWPFRun是XWPFDocument中的一段文本对象(就是一段文 ...
- 使用POI操作Excel
首先要下载所需jar包, 官网:http://poi.apache.org ,POI支持office的所有版本 下载完后,打开“poi-bin-3.10.1-20140818”获取操作excel需要的 ...
- apache POI 操作excel<导入导出>
1.首先导入maven依赖 <!-- POI核心依赖 --> <dependency> <groupId>org.apache.poi</groupId> ...
- 利用POI操作不同版本号word文档中的图片以及创建word文档
我们都知道要想利用java对office操作最经常使用的技术就应该是POI了,在这里本人就不多说到底POI是什么和怎么用了. 先说本人遇到的问题,不同于利用POI去向word文档以及excel文档去写 ...
随机推荐
- HNOI2015菜肴制作
一开始,没想出来,先topsort判环,把impossible拿到手,然后划分联通块,对每个联通块跑一遍topsort,觉得可对了,然后被大样例教育明白了,知道自己的策略错在哪了. 接着在纸上疯狂手模 ...
- 文字和符号组合成图 Banner
springboot 启动 logo.... 文字符号组合成的图. <<< | /\\\ /--\\\ / \\\\ <*| /________\\\\ | ___ | | | ...
- python pymysql 连接 mysql数据库进行操作
1.数据库的连接操作 import pymysql conn = pymysql.connect(host=', db='oldboydb') # host表示ip地址,user表示用户名,passw ...
- javascript之BOM对象总结
BOM编程基础 全称 Browser Object Model,浏览器对象模型. JavaScript是由浏览器中内置的javascript脚本解释器程序来执行javascript脚本语言的. 为了便 ...
- C基础知识(11):错误处理
C语言不提供对错误处理的直接支持,但是作为一种系统编程语言,它以返回值的形式允许您访问底层数据.在发生错误时,大多数的C或UNIX函数调用返回1或NULL,同时会设置一个错误代码errno,该错误代码 ...
- GitLab 架构
GitLab 架构官方文档 GitLab 中文文档 版本 一般使用的是社区版(Community Edition,CE),此外还有企业版(Enterprise Edition,EE)可以使用. EE ...
- DDoS攻击的几种类型
DDoS攻击的几种类型 随着网络攻击的简单化,如今DDoS攻击已经不止出现在大型网站中,就连很多中小型网站甚至是个人网站往往都可能面临着被DDoS攻击的的风险.或许很多站长对DDoS攻击并不是很了 ...
- easyui datagrid checkbox复选框取消单击选中事件、初始全选全不选等问题解决
系统业务需要,导入的列表数据默认全部选中,且不可取消选中行.全部店铺优惠券发放过后导入的数据全部清空.如图所示: 一.初始化页面默认全部选中“selectAll”,全部不选中“unselectAll” ...
- python-Web-django-富文本编辑器
views: def gbook(request): '''''' text = request.POST.get('text') soup = BeautifulSoup(text, "h ...
- 华为HCNA乱学Round 4:RIP