老熟女激烈的高潮_日韩一级黄色录像_亚洲1区2区3区视频_精品少妇一区二区三区在线播放_国产欧美日产久久_午夜福利精品导航凹凸

重慶分公司,新征程啟航

為企業提供網站建設、域名注冊、服務器等服務

利用JavaApachePOI生成Word文檔示例代碼

最近公司做的項目需要實現導出Word文檔的功能,網上關于POI生成Word文檔的例子很少,找了半天才在官網里找到個Demo,有了Demo一切就好辦了。

高臺ssl適用于網站、小程序/APP、API接口等需要進行數據傳輸應用場景,ssl證書未來市場廣闊!成為創新互聯的ssl證書銷售渠道,可以享受市場價格4-6折優惠!如果有意向歡迎電話聯系或者加微信:18980820575(備注:SSL證書合作)期待與您的合作!

/* ==================================================================== 
  Licensed to the Apache Software Foundation (ASF) under one or more 
  contributor license agreements. See the NOTICE file distributed with 
  this work for additional information regarding copyright ownership. 
  The ASF licenses this file to You under the Apache License, Version 2.0 
  (the "License"); you may not use this file except in compliance with 
  the License. You may obtain a copy of the License at 
 
    http://www.apache.org/licenses/LICENSE-2.0 
 
  Unless required by applicable law or agreed to in writing, software 
  distributed under the License is distributed on an "AS IS" BASIS, 
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
  See the License for the specific language governing permissions and 
  limitations under the License. 
==================================================================== */ 
package org.apache.poi.xwpf.usermodel; 
 
import java.io.FileOutputStream; 
 
/** 
 * A simple WOrdprocessingML document created by POI XWPF API 
 * 
 * @author Yegor Kozlov 
 */ 
public class SimpleDocument { 
 
  public static void main(String[] args) throws Exception { 
    XWPFDocument doc = new XWPFDocument(); 
 
    XWPFParagraph p1 = doc.createParagraph(); 
    p1.setAlignment(ParagraphAlignment.CENTER); 
    p1.setBorderBottom(Borders.DOUBLE); 
    p1.setBorderTop(Borders.DOUBLE); 
 
    p1.setBorderRight(Borders.DOUBLE); 
    p1.setBorderLeft(Borders.DOUBLE); 
    p1.setBorderBetween(Borders.SINGLE); 
 
    p1.setVerticalAlignment(TextAlignment.TOP); 
 
    XWPFRun r1 = p1.createRun(); 
    r1.setBold(true); 
    r1.setText("The quick brown fox"); 
    r1.setBold(true); 
    r1.setFontFamily("Courier"); 
    r1.setUnderline(UnderlinePatterns.DOT_DOT_DASH); 
    r1.setTextPosition(100); 
 
    XWPFParagraph p2 = doc.createParagraph(); 
    p2.setAlignment(ParagraphAlignment.RIGHT); 
 
    //BORDERS 
    p2.setBorderBottom(Borders.DOUBLE); 
    p2.setBorderTop(Borders.DOUBLE); 
    p2.setBorderRight(Borders.DOUBLE); 
    p2.setBorderLeft(Borders.DOUBLE); 
    p2.setBorderBetween(Borders.SINGLE); 
 
    XWPFRun r2 = p2.createRun(); 
    r2.setText("jumped over the lazy dog"); 
    r2.setStrike(true); 
    r2.setFontSize(20); 
 
    XWPFRun r3 = p2.createRun(); 
    r3.setText("and went away"); 
    r3.setStrike(true); 
    r3.setFontSize(20); 
    r3.setSubscript(VerticalAlign.SUPERSCRIPT); 
 
 
    XWPFParagraph p3 = doc.createParagraph(); 
    p3.setWordWrap(true); 
    p3.setPageBreak(true); 
         
    //p3.setAlignment(ParagraphAlignment.DISTRIBUTE); 
    p3.setAlignment(ParagraphAlignment.BOTH); 
    p3.setSpacingLineRule(LineSpacingRule.EXACT); 
 
    p3.setIndentationFirstLine(600); 
     
 
    XWPFRun r4 = p3.createRun(); 
    r4.setTextPosition(20); 
    r4.setText("To be, or not to be: that is the question: " 
        + "Whether 'tis nobler in the mind to suffer " 
        + "The slings and arrows of outrageous fortune, " 
        + "Or to take arms against a sea of troubles, " 
        + "And by opposing end them? To die: to sleep; "); 
    r4.addBreak(BreakType.PAGE); 
    r4.setText("No more; and by a sleep to say we end " 
        + "The heart-ache and the thousand natural shocks " 
        + "That flesh is heir to, 'tis a consummation " 
        + "Devoutly to be wish'd. To die, to sleep; " 
        + "To sleep: perchance to dream: ay, there's the rub; " 
        + "......."); 
    r4.setItalic(true); 
//This would imply that this break shall be treated as a simple line break, and break the line after that word: 
 
    XWPFRun r5 = p3.createRun(); 
    r5.setTextPosition(-10); 
    r5.setText("For in that sleep of death what dreams may come"); 
    r5.addCarriageReturn(); 
    r5.setText("When we have shuffled off this mortal coil," 
        + "Must give us pause: there's the respect" 
        + "That makes calamity of so long life;"); 
    r5.addBreak(); 
    r5.setText("For who would bear the whips and scorns of time," 
        + "The oppressor's wrong, the proud man's contumely,"); 
     
    r5.addBreak(BreakClear.ALL); 
    r5.setText("The pangs of despised love, the law's delay," 
        + "The insolence of office and the spurns" + "......."); 
 
    FileOutputStream out = new FileOutputStream("simple.docx"); 
    doc.write(out); 
    out.close(); 
 
  } 
} 

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持創新互聯。


網站題目:利用JavaApachePOI生成Word文檔示例代碼
URL標題:http://www.xueling.net.cn/article/peiidd.html

其他資訊

在線咨詢
服務熱線
服務熱線:028-86922220
TOP
主站蜘蛛池模板: 4虎海外永久域站 | 国产美女一区 | 调教小奴高潮惩罚PLAY露出 | 色8久久久噜噜噜久久 | 91一区二区三区在线观看 | 很黄很黄的曰批视频 | 一二三四在线播放免费观看中文版视频 | swag破解版 | 一区二区三区四区五区在线 | 国产在线无码精品无码 | 日本精品少妇人妖啪啪 | 国产精品无码AV一区二区三区 | 欧美在线成人影院 | 国产超aⅤ男人的天堂 | 欧美大陆国产 | 国产精品久久不射 | 亚洲网站免费看 | 日韩a在线看免费观看视频 国产做a爱一级毛片久 | 国产无遮挡又黄又爽不要VIP网站 | 天天干天天操天天拍 | 丰满少妇高潮惨叫久久久一 | 未满小14洗澡无码视频网站 | 成人一区二区三区在线 | 一区久久精品 | 福利网址| 影视先锋AV资源噜噜 | 精品久久久久久无码中文字幕一区 | 久久青青操 | 三级在线国产 | 无码精品人妻一区二区三区共妻 | 国产在线精品一区二区三区不卡 | 最近中文AV字幕在线中文 | 手机免费一级片 | 亚洲激情一级片 | 在线观看91av | JAPANESE国产高清在线观看播放 | 成人欧美一区二区三区黑人孕妇 | 亚洲Av纯肉无码精品动漫 | 四虎影视网站 | 日韩一区二区精品视频 | 99re在线视频免费观看 |