混在南京

          來(lái)自揚(yáng)州的程序員

          2006年8月23日 #

          那么,你的修養(yǎng)就會(huì)如天地般博大

          那么,你的修養(yǎng)就會(huì)如天地般博大


          如果在眾人六神無(wú)主之時(shí),你能鎮(zhèn)定自如而不是人云亦云;
          如果被眾人猜忌懷疑時(shí),你能自信如常而不去妄加辯論;
          如果你有夢(mèng)想,又能不迷失自我;
          如果你有神思,又不至于走火入魔;
          如果在成功之中能不忘形于色,而在災(zāi)難之后也勇于咀嚼苦果;
          如果看到自己追求的美好破滅為一堆零碎的瓦礫,也不說(shuō)放棄;
          如果你辛苦勞作,已是功成名就,為了新目標(biāo)你依舊冒險(xiǎn)一搏,哪怕名成為烏有;
          如果你跟村夫交流而不變謙恭之態(tài),和王侯散步而不露獻(xiàn)媚之顏;
          如果他人的愛(ài)情左右不了你,如果你與任何人為伍都能卓然獨(dú)立;
          如果昏惑的騷擾動(dòng)搖不了你的意志,你能等自己平心靜氣,再作答時(shí);
          那么,你的修養(yǎng)就會(huì)如天地般博大,而你就是個(gè)真正的 男子漢.

          posted @ 2006-08-23 14:49 麥大海 閱讀(342) | 評(píng)論 (0)編輯 收藏

          2006年7月4日 #

          使用POI的HWPF操作word(未解決中文亂碼問(wèn)題)

          public class TestPoi extends HttpServlet
          {

          ?public void doGet(HttpServletRequest request, HttpServletResponse response)
          ???throws ServletException
          ?{
          ??File file = new File("D:\\b.doc");
          ??try
          ??{
          ???FileInputStream in = new FileInputStream("D:\\b.doc");
          ???// HWPFFileSystem hwpfsys = new HWPFFileSystem();
          ???// hwpfsys.getStream("d://b.doc");
          ???POIFSFileSystem pfs = new POIFSFileSystem(in);
          ???HWPFDocument hwpf = new HWPFDocument(pfs);
          ???// hwpf.write(hwpfsys.getStream("D://e.doc"));
          ???// Range range = new Range(0, (int) file.length(), hwpf);
          ???Range range = hwpf.getRange();
          ???StyleSheet styleSheet = hwpf.getStyleSheet();

          ???TableIterator it = new TableIterator(range);
          //遍歷一個(gè)DOC中的所有表格
          ???while (it.hasNext())
          ???{
          ????Table tb = (Table) it.next();

          ? //遍歷表格的行
          ????for (int i = 0; i < tb.numRows(); i++)
          ????{
          ?????TableRow tr = tb.getRow(i);
          //遍歷表格的列
          ?????for (int j = 0; j < tr.numCells(); j++)
          ?????{
          ??? //往表格中插入數(shù)據(jù)?
          ?????TableCell td = tr.getCell(j);
          ??????String text = "第" + i + "行第" + j + "列";
          ??????int p = td.numParagraphs();
          ??????Paragraph para = td.getParagraph(p);
          ??????ParagraphProperties pp = new ParagraphProperties();
          ??????para.insertBefore(text);
          ?????}
          ????}
          ???}
          //在表格外面插入內(nèi)容??
          ?CharacterProperties cp = new CharacterProperties();
          ???cp.setBold(true);
          ???cp.setCharacterSpacing(10);
          ???cp.setChse(cp.SPRM_CHARSCALE);
          ???cp.setCapitalized(true);
          ???int p = range.numParagraphs();
          ???Paragraph para = range.getParagraph(p - 1);
          ???para.insertAfter("test poi successful!", cp);
          ???para.insertAfter("測(cè)試成功", cp);
          ???response.setContentType("application/vnd.ms-word");
          ???response.setHeader("Content-disposition", "attachment;filename=e.doc");
          ???OutputStream out = response.getOutputStream();
          ???hwpf.write(out);
          ???out.close();
          ??}
          ??catch (Exception ex)
          ??{
          ???ex.printStackTrace();
          ??}
          ?}

          ?public void doPost(HttpServletRequest request, HttpServletResponse response)
          ???throws ServletException
          ?{
          ??doGet(request, response);
          ?}

          }

          posted @ 2006-07-04 10:30 麥大海 閱讀(3004) | 評(píng)論 (0)編輯 收藏

          僅列出標(biāo)題  
          主站蜘蛛池模板: 元阳县| 玉田县| 临海市| 车致| 枝江市| 大港区| 博客| 百色市| 宜兰县| 大田县| 桑植县| 邵阳市| 富源县| 尤溪县| 余姚市| 南岸区| 青龙| 四子王旗| 涟源市| 宜春市| 富锦市| 哈巴河县| 香河县| 荃湾区| 河池市| 上饶县| 宿州市| 延安市| 舟山市| 马关县| 龙游县| 平凉市| 威海市| 广河县| 沭阳县| 沈丘县| 海原县| 运城市| 徐州市| 清水河县| 巴彦淖尔市|