array(2) { ["docs"]=> array(10) { [0]=> array(10) { ["id"]=> string(3) "428" ["text"]=> string(77) "Visual Studio 2017 单独启动MSDN帮助(Microsoft Help Viewer)的方法" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(8) "DonetRen" ["tagsname"]=> string(55) "Visual Studio 2017|MSDN帮助|C#程序|.NET|Help Viewer" ["tagsid"]=> string(23) "[401,402,403,"300",404]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400964" ["_id"]=> string(3) "428" } [1]=> array(10) { ["id"]=> string(3) "427" ["text"]=> string(42) "npm -v;报错 cannot find module "wrapp"" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "zzty" ["tagsname"]=> string(50) "node.js|npm|cannot find module "wrapp“|node" ["tagsid"]=> string(19) "[398,"239",399,400]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400760" ["_id"]=> string(3) "427" } [2]=> array(10) { ["id"]=> string(3) "426" ["text"]=> string(54) "说说css中pt、px、em、rem都扮演了什么角色" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(12) "zhengqiaoyin" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400640" ["_id"]=> string(3) "426" } [3]=> array(10) { ["id"]=> string(3) "425" ["text"]=> string(83) "深入学习JS执行--创建执行上下文(变量对象,作用域链,this)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "Ry-yuan" ["tagsname"]=> string(33) "Javascript|Javascript执行过程" ["tagsid"]=> string(13) "["169","191"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511399901" ["_id"]=> string(3) "425" } [4]=> array(10) { ["id"]=> string(3) "424" ["text"]=> string(30) "C# 排序技术研究与对比" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "vveiliang" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(8) ".Net Dev" ["catesid"]=> string(5) "[199]" ["createtime"]=> string(10) "1511399150" ["_id"]=> string(3) "424" } [5]=> array(10) { ["id"]=> string(3) "423" ["text"]=> string(72) "【算法】小白的算法笔记:快速排序算法的编码和优化" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "penghuwan" ["tagsname"]=> string(6) "算法" ["tagsid"]=> string(7) "["344"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511398109" ["_id"]=> string(3) "423" } [6]=> array(10) { ["id"]=> string(3) "422" ["text"]=> string(64) "JavaScript数据可视化编程学习(二)Flotr2,雷达图" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "chengxs" ["tagsname"]=> string(28) "数据可视化|前端学习" ["tagsid"]=> string(9) "[396,397]" ["catesname"]=> string(18) "前端基本知识" ["catesid"]=> string(5) "[198]" ["createtime"]=> string(10) "1511397800" ["_id"]=> string(3) "422" } [7]=> array(10) { ["id"]=> string(3) "421" ["text"]=> string(36) "C#表达式目录树(Expression)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "wwym" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(4) ".NET" ["catesid"]=> string(7) "["119"]" ["createtime"]=> string(10) "1511397474" ["_id"]=> string(3) "421" } [8]=> array(10) { ["id"]=> string(3) "420" ["text"]=> string(47) "数据结构 队列_队列实例:事件处理" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "idreamo" ["tagsname"]=> string(40) "C语言|数据结构|队列|事件处理" ["tagsid"]=> string(23) "["246","247","248",395]" ["catesname"]=> string(12) "数据结构" ["catesid"]=> string(7) "["133"]" ["createtime"]=> string(10) "1511397279" ["_id"]=> string(3) "420" } [9]=> array(10) { ["id"]=> string(3) "419" ["text"]=> string(47) "久等了,博客园官方Android客户端发布" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(3) "cmt" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511396549" ["_id"]=> string(3) "419" } } ["count"]=> int(200) } 222 itext生成word文档使用笔记 - 爱码网
private static void CreateWord()
 {
  String filePath="D:\\fjs\\oil1out";
  String filePath2="D:\\fjs\\oil2out";
  BufferedReader br;
  BufferedReader br2;
  //定义A4页面大小
  Rectangle rectPageSize = new Rectangle(PageSize.A4);
  rectPageSize = rectPageSize.rotate();
  // 创建word文档,并设置纸张的大小
  Document document = new Document(rectPageSize,80, 80, 50,50); //建立文档
  try {
   //try start
   br = new BufferedReader(new InputStreamReader(
     new FileInputStream(filePath)));
   br2 = new BufferedReader(new InputStreamReader(
     new FileInputStream(filePath2)));
   
  
   RtfWriter2.getInstance(document,new FileOutputStream("E:/word121.doc"));  //创建一个书写器
   document.open();
   
   for(int rainTypeCount=0;rainTypeCount<4;rainTypeCount++)
   {
    //读取下雨类型
    String rainType=rainType(br.readLine());  
    br2.readLine();
    for(int realseTypeCount=0;realseTypeCount<8;realseTypeCount++)
    {
      //生成=======大雨,PWR4
      Paragraph p = new Paragraph(rainType+","+realseType(br.readLine()), new Font(Font.NORMAL, 18, Font.BOLD, new Color(0, 9, 9)) ); 
      br2.readLine();
      p.setAlignment(1);   
      document.add(p);
     
      
      Table table = new Table(14); //14列  
       table.setWidth(Float.parseFloat("100"));
       table.setAlignment(Element.ALIGN_CENTER);
       table.setAlignment(Element.ALIGN_MIDDLE);// 纵向居中显示
        table.setBorderWidth(1);  
        table.setBorderColor(Color.BLACK);
        table.setPadding(0);   
        table.setSpacing(0);   
     
        // * 添加表头
        Cell cell = new Cell("稳定度");// 单元格
        cell.setHeader(true);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
      cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setHorizontalAlignment(10);
        cell.setRowspan(2);// 设置表格为2行
        table.addCell(cell);
     
        cell = new Cell("风速级(m/s)");// 单元格
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
       cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setHeader(true);  
        cell.setRowspan(2);// 设置表格为2行
        table.addCell(cell);
       
        cell = new Cell("下风向距离上的OIL1(mSv/h)");// 单元格
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setHeader(true);  
        cell.setColspan(6);// 设置表格为6列
        table.addCell(cell);
       
        cell = new Cell("下风向距离上的OIL2(mSv/h)");// 单元格
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setHeader(true);  
        cell.setColspan(6);// 设置表格为6列
        table.addCell(cell); 
        for(int i=0;i<2;i++)
        {
         cell=new Cell("1km");
         cell.setVerticalAlignment(Element.ALIGN_CENTER);
         cell.setHorizontalAlignment(Element.ALIGN_CENTER);        
         table.addCell(cell);
         cell=new Cell("2km");
         cell.setVerticalAlignment(Element.ALIGN_CENTER);
         cell.setHorizontalAlignment(Element.ALIGN_CENTER);
         table.addCell(cell);
         cell=new Cell("3.33km");
         cell.setVerticalAlignment(Element.ALIGN_CENTER);
         cell.setHorizontalAlignment(Element.ALIGN_CENTER);
         table.addCell(cell);
         cell=new Cell("5km");
         cell.setVerticalAlignment(Element.ALIGN_CENTER);
         cell.setHorizontalAlignment(Element.ALIGN_CENTER);
         table.addCell(cell);
         cell=new Cell("6.67km");
         cell.setVerticalAlignment(Element.ALIGN_CENTER);
         cell.setHorizontalAlignment(Element.ALIGN_CENTER);
         table.addCell(cell);
         cell=new Cell("10km");
         cell.setVerticalAlignment(Element.ALIGN_CENTER);
         cell.setHorizontalAlignment(Element.ALIGN_CENTER);
         table.addCell(cell);
        }
       
        table.endHeaders();// 表头结束
       
     // 表格的主体
        br.readLine();   //距离
        br.readLine();   //稳定度     风速          1.00        2.00        3.33        5.00        6.67       10.00
        br2.readLine();  //距离
        br2.readLine();  //稳定度     风速          1.00        2.00        3.33        5.00        6.67       10.00
       
        for(int i=0;i<6;i++)
        {
         for(int j=0;j<9;j++)
         {
        
          String row=br.readLine(); //A            1.0          0.17        0.21        0.21        0.20        0.18        0.15
          String row2= br2.readLine();
          if(j==0)
          {
           cell = new Cell(row.substring(0, 1));  //A
       
           cell.setVerticalAlignment(Element.ALIGN_CENTER);
           cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        
           cell.setRowspan(9);// 当前单元格占两行,纵向跨度
           table.addCell(cell);  
          }
        
          cell = new Cell(windSpeed(j));  //A         
          cell.setVerticalAlignment(Element.ALIGN_CENTER);
          cell.setHorizontalAlignment(Element.ALIGN_CENTER);
          table.addCell(cell);
         
          for(int m =0;m<6;m++)
        {
           cell=new Cell(row.substring(row.length()-(6-m)*12, row.length()-(5-m)*12).trim());
           cell.setVerticalAlignment(Element.ALIGN_CENTER);
           cell.setHorizontalAlignment(Element.ALIGN_CENTER);
           table.addCell(cell);
           //table.addCell(row.substring(row.length()-(6-m)*12, row.length()-(5-m)*12).trim());
        }
        
        for(int n =0;n<6;n++)
        {
          cell=new Cell(row.substring(row2.length()-(6-n)*12, row2.length()-(5-n)*12).trim());
            cell.setVerticalAlignment(Element.ALIGN_CENTER);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(cell);
        // table.addCell(row2.substring(row2.length()-(6-n)*12, row2.length()-(5-n)*12).trim());
        }
         }
        }       
        document.add(table);
    }    
   }
   br.close();
   br2.close();
   document.close();
   System.out.println("文档已生成!");
   //try end
  } catch (FileNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (DocumentException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  
 }

相关文章: