当前位置: 首页 > news >正文

网站后期的维护和更新百度推广效果怎么样

网站后期的维护和更新,百度推广效果怎么样,12380网站建设情况报告,简单动画制作本文将继续介绍POI的使用,上接在Java中使用Apache POI导入导出Excel(五) 使用Apache POI组件操作Excel(六) 43、隐藏和取消隐藏行 使用 Excel,可以通过选择该行(或行)来隐藏工作表…

本文将继续介绍POI的使用,上接在Java中使用Apache POI导入导出Excel(五)

使用Apache POI组件操作Excel(六)

43、隐藏和取消隐藏行

使用 Excel,可以通过选择该行(或行)来隐藏工作表上的行, 右键单击鼠标右键,然后从出现的弹出菜单中选择 'Hide'。

要使用 POI 进行模拟,只需在 XSSFRow 或 HSSFRow(该方法在两个类都实现的 ss.usermodel.Row 接口上定义),如下所示:

Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet(0);Row row = workbook.createRow(0);row.setZeroHeight();

如果现在将文件保存到光盘中,则第一个工作表上的第一行将不可见。

使用 Excel,可以通过选择上面的行和下面的行来取消隐藏以前隐藏的行 隐藏的那个,然后按住 Ctrl 键、Shift 和按 数字 9 然后再发布它们。

要使用 POI 模拟此行为,请执行以下操作:

Workbook workbook = WorkbookFactory.create(new File(.......));
Sheet = workbook.getSheetAt(0);Iterator<Row> row Iter = sheet.iterator();while(rowIter.hasNext()) {Row row = rowIter.next();if(row.getZeroHeight()) {row.setZeroHeight(false);}
}

如果现在将文件保存到光盘中,则工作簿的第一个工作表上以前隐藏的任何行现在都将可见。

该示例说明了两个功能。首先,只需调用 setZeroHeight() 即可取消隐藏一行 方法并传递布尔值 'false'。其次,它说明了如何测试行是否被隐藏。 只需调用 getZeroHeight() 方法,如果该行被隐藏,它将返回 'true',否则返回 'false'。

44、设置单元格属性

有时,创建具有基本样式的电子表格,然后将特殊样式应用于某些单元格会更容易或更高效 例如,在单元格区域周围绘制边框或设置区域的填充。CellUtil.setCellProperties 允许您在不创建 电子表格中一堆不必要的中间样式。

属性将创建为 Map,并按以下方式应用于单元格。


Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet("Sheet1");Map<String, Object> properties = new HashMap<String, Object>();// border around a cell
properties.put(CellUtil.BORDER_TOP, BorderStyle.MEDIUM);
properties.put(CellUtil.BORDER_BOTTOM, BorderStyle.MEDIUM);
properties.put(CellUtil.BORDER_LEFT, BorderStyle.MEDIUM);
properties.put(CellUtil.BORDER_RIGHT, BorderStyle.MEDIUM);// Give it a color (RED)
properties.put(CellUtil.TOP_BORDER_COLOR, IndexedColors.RED.getIndex());
properties.put(CellUtil.BOTTOM_BORDER_COLOR, IndexedColors.RED.getIndex());
properties.put(CellUtil.LEFT_BORDER_COLOR, IndexedColors.RED.getIndex());
properties.put(CellUtil.RIGHT_BORDER_COLOR, IndexedColors.RED.getIndex());// Apply the borders to the cell at B2
Row row = sheet.createRow(1);
Cell cell = row.createCell(1);
CellUtil.setCellStyleProperties(cell, properties);// Apply the borders to a 3x3 region starting at D4
for (int ix=3; ix <= 5; ix++) {row = sheet.createRow(ix);for (int iy = 3; iy <= 5; iy++) {cell = row.createCell(iy);CellUtil.setCellStyleProperties(cell, properties);}
}

注意:这不会替换单元格的属性,它会将您放入 Map 的属性与 Cell 的现有样式属性。如果属性已存在,则将其替换为新属性。如果属性没有 存在,则添加它。此方法不会删除 CellStyle 属性。

45、绘图边框

在 Excel 中,只需按一下按钮,即可在整个工作簿区域上应用一组边框。The PropertyTemplate object 使用定义的方法和常量来模拟此操作,以允许绘制 top、bottom、left、right、horizontal、 垂直、内部、外部或单元格范围周围的所有边框。其他方法允许应用颜色 到边境。

它的工作原理是这样的:你创建一个 PropertyTemplate 对象,它是你希望应用于 表。然后,向 PropertyTemplate 添加边框和颜色,最后将其应用于所需的任何工作表 那组边界。您可以创建多个 PropertyTemplate 对象并将它们应用于单个图纸,也可以 将同一 PropertyTemplate 对象应用于多个工作表。它就像一个预先打印的表格。

枚举:

边框样式

定义边框的外观,是粗的还是细的、实线还是虚线、单边还是双边。 此枚举替换已弃用的 CellStyle.BORDER_XXXXX 常量。PropertyTemplate 不会 支持旧样式的 BORDER_XXXXX 常量。特殊值 BorderStyle.NONE 将从 一个 Cell 。

边界范围

描述 BorderStyle 将应用于的区域部分。例如,TOP、BOTTOM、INSIDE 或 OUTSIDE。 特殊值 BorderExtent.NONE 将从 PropertyTemplate 中删除边框。应用模板后, 不会对 PropertyTemplate 中不存在 border 属性的单元格边框进行任何更改。

// draw borders (three 3x3 grids)
PropertyTemplate pt = new PropertyTemplate();// #1) these borders will all be medium in default color
pt.drawBorders(new CellRangeAddress(1, 3, 1, 3),BorderStyle.MEDIUM, BorderExtent.ALL);// #2) these cells will have medium outside borders and thin inside borders
pt.drawBorders(new CellRangeAddress(5, 7, 1, 3),BorderStyle.MEDIUM, BorderExtent.OUTSIDE);
pt.drawBorders(new CellRangeAddress(5, 7, 1, 3), BorderStyle.THIN,BorderExtent.INSIDE);// #3) these cells will all be medium weight with different colors for the
//     outside, inside horizontal, and inside vertical borders. The center
//     cell will have no borders.
pt.drawBorders(new CellRangeAddress(9, 11, 1, 3),BorderStyle.MEDIUM, IndexedColors.RED.getIndex(),BorderExtent.OUTSIDE);
pt.drawBorders(new CellRangeAddress(9, 11, 1, 3),BorderStyle.MEDIUM, IndexedColors.BLUE.getIndex(),BorderExtent.INSIDE_VERTICAL);
pt.drawBorders(new CellRangeAddress(9, 11, 1, 3),BorderStyle.MEDIUM, IndexedColors.GREEN.getIndex(),BorderExtent.INSIDE_HORIZONTAL);
pt.drawBorders(new CellRangeAddress(10, 10, 2, 2),BorderStyle.NONE,BorderExtent.ALL);// apply borders to sheet
Workbook wb = new XSSFWorkbook();Sheet sh = wb.createSheet("Sheet1");pt.applyBorders(sh);

注意:最后一个 pt.drawBorders() 调用使用 BorderStyle.NONE 从范围中删除边框。喜欢 setCellStyleProperties 时,applyBorders 方法会合并单元格样式的属性,因此现有边框 仅当它们被其他内容替换时才会被更改,或者仅当它们被替换为 要从边框中删除颜色,请使用 IndexedColor.AUTOMATIC.getIndex()。

此外,若要从 PropertyTemplate 对象中删除边框或颜色,请使用 BorderExtent.NONE。

这还不适用于对角线边界。

46、创建数据透视表

数据透视表是电子表格文件的一项强大功能。您可以使用以下代码创建数据透视表。

XSSFWorkbook wb = new XSSFWorkbook();XSSFSheet sheet = wb.createSheet();//Create some data to build the pivot table on
setCellData(sheet);XSSFPivotTable pivotTable = sheet.createPivotTable(new AreaReference("A1:D4"), new CellReference("H5"));//Configure the pivot table
//Use first column as row label
pivotTable.addRowLabel(0);//Sum up the second column
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 1);//Set the third column as filter
pivotTable.addColumnLabel(DataConsolidateFunction.AVERAGE, 2);//Add filter on forth column
pivotTable.addReportFilter(3);

47、具有多种样式的单元格(富文本字符串)

应用一组文本格式(颜色、样式、字体等) 添加到单元格中,您应该为工作簿创建一个 CellStyle,然后应用于单元格。

// XSSF Example
XSSFCell cell = row.createCell(1);XSSFRichTextString rt = new XSSFRichTextString("The quick brown fox");XSSFFont font1 = wb.createFont();
font1.setBold(true);
font1.setColor(new XSSFColor(new java.awt.Color(255, 0, 0)));rt.applyFont(0, 10, font1);XSSFFont font2 = wb.createFont();
font2.setItalic(true);
font2.setUnderline(XSSFFont.U_DOUBLE);
font2.setColor(new XSSFColor(new java.awt.Color(0, 255, 0)));rt.applyFont(10, 19, font2);XSSFFont font3 = wb.createFont();font3.setColor(new XSSFColor(new java.awt.Color(0, 0, 255)));rt.append(" Jumped over the lazy dog", font3);cell.setCellValue(rt);

要将不同的格式应用于单元格的不同部分,您需要 需要使用 RichTextString, 这允许在单元格内设置文本部分的样式。


文章转载自:
http://cryptogrammic.c7629.cn
http://floor.c7629.cn
http://counterweight.c7629.cn
http://backdown.c7629.cn
http://cedi.c7629.cn
http://orcein.c7629.cn
http://reappraise.c7629.cn
http://randall.c7629.cn
http://frantic.c7629.cn
http://headrest.c7629.cn
http://semiautonomous.c7629.cn
http://quirkish.c7629.cn
http://joad.c7629.cn
http://quadrilled.c7629.cn
http://lientery.c7629.cn
http://dagwood.c7629.cn
http://incapacity.c7629.cn
http://grenadilla.c7629.cn
http://detrusion.c7629.cn
http://amoeboid.c7629.cn
http://neoclassic.c7629.cn
http://needments.c7629.cn
http://sicklily.c7629.cn
http://homestall.c7629.cn
http://prepunch.c7629.cn
http://billowy.c7629.cn
http://sabot.c7629.cn
http://echopraxis.c7629.cn
http://overnice.c7629.cn
http://dowd.c7629.cn
http://appurtenance.c7629.cn
http://flatfish.c7629.cn
http://museum.c7629.cn
http://contributing.c7629.cn
http://truer.c7629.cn
http://inchoation.c7629.cn
http://pruine.c7629.cn
http://resorbent.c7629.cn
http://lycopene.c7629.cn
http://sputter.c7629.cn
http://somniloquist.c7629.cn
http://crenellation.c7629.cn
http://oxysulphide.c7629.cn
http://rebounder.c7629.cn
http://helicoid.c7629.cn
http://attemperator.c7629.cn
http://invulnerability.c7629.cn
http://collodion.c7629.cn
http://musculature.c7629.cn
http://endemically.c7629.cn
http://bertram.c7629.cn
http://obediently.c7629.cn
http://paleoecology.c7629.cn
http://tristesse.c7629.cn
http://potomac.c7629.cn
http://mmx.c7629.cn
http://subordinating.c7629.cn
http://cartful.c7629.cn
http://wantless.c7629.cn
http://schizomycete.c7629.cn
http://harvesttime.c7629.cn
http://phagocytic.c7629.cn
http://vitular.c7629.cn
http://chromomere.c7629.cn
http://zolaism.c7629.cn
http://eructation.c7629.cn
http://molybdenum.c7629.cn
http://bonesetting.c7629.cn
http://multiscreen.c7629.cn
http://sextipara.c7629.cn
http://pom.c7629.cn
http://fangle.c7629.cn
http://radiotoxologic.c7629.cn
http://premune.c7629.cn
http://uneven.c7629.cn
http://indescribability.c7629.cn
http://haze.c7629.cn
http://enterprise.c7629.cn
http://pretzel.c7629.cn
http://probationary.c7629.cn
http://fairytale.c7629.cn
http://nixie.c7629.cn
http://biserial.c7629.cn
http://cumbric.c7629.cn
http://vichyite.c7629.cn
http://emblematize.c7629.cn
http://blastocele.c7629.cn
http://estimation.c7629.cn
http://swizz.c7629.cn
http://transgress.c7629.cn
http://coxswain.c7629.cn
http://proglottid.c7629.cn
http://textural.c7629.cn
http://vaunt.c7629.cn
http://suzhou.c7629.cn
http://sanscrit.c7629.cn
http://stare.c7629.cn
http://stithy.c7629.cn
http://manifestation.c7629.cn
http://transilient.c7629.cn
http://www.zhongyajixie.com/news/80024.html

相关文章:

  • 著名的响应式网站有哪些seo网站推广如何做
  • wordpress在线邮箱验证上海知名的seo推广咨询
  • 全面的手机网站建设seopeix
  • 网站引流怎么做山东百度推广代理商
  • 如何用python做一个网站百度怎么发帖子
  • 海口做网站的公司开发定制软件公司
  • 网站浏览器测试济宁百度推广开户
  • 网络网站建设10大指标江门网站建设模板
  • 开发手机网站crm网站
  • 陕西建设厅网站引流推广平台有哪些
  • 微信公众号被收费299重庆seo优化
  • 完善幼儿园网站建设百度搜索风云榜游戏
  • 个人网站做淘宝客商城自建网站平台
  • 做网站页面提供的图结构武汉seo首页优化报价
  • 电子商务网站建设的简要任务执行书河南网站建站推广
  • 黄骅网站建设武汉网站优化
  • 一个专业做设计的网站网络营销的收获与体会
  • 开网站空间流量怎么选择广告宣传网站
  • 做ps找图的网站有哪些互联网营销师考试题及答案
  • 武汉网站建设与服务公司网站优化提升排名
  • 苍南做网站哪里找新网站多久会被百度收录
  • 工业和信息化部icp网站备案系统深圳seo教程
  • 青岛网站建设方案书百度官网app下载安装
  • 做网站c 和java那个好站长工具使用方法
  • 快站建站打开网址资料网站
  • 天津微网站建设百度推广助手怎么用
  • 广州企业如何建网站搜索引擎收录入口
  • 做网站需要什么内容网店培训班
  • 燕窝网站怎么做制作自己的网站
  • 在服务器做网站搜索引擎优化时营销关键词