1.使用apache poi元件
///使用poi的wordextractor類進行讀取word內容
private string readdoc(string doc) throws exception
}2. 使用poi的拓展包tm-extractors-0.4.jar
替換掉原先readdoc(string doc)方法就可以。
private string readdoc(string doc) throws exception
3. 使用fileinputstream流的方式:
用下面替換掉content_type(因為流對word格式不熟悉無法自己處理,所以只能使用word格式了)
用下面替換dopost方法內容
response.setcontenttype(content_type);
response.setheader("content-disposition", "test.doc");
string doc = request.getparameter("doc");
fileinputstream fin = new fileinputstream(doc);
outputstream out = response.getoutputstream();
byte bs = new byte[2048];
for(int i=fin.read(bs); i>-1; i=fin.read(bs))
fin.close();
out.close();
4. 可以使用中介軟體,效果當然很好,但是要花錢。如:科翰軟體的微軟office網路中介軟體
或者ntko office也可以。
css有幾種引入方式
1.使用html標籤的style屬性 將style屬性直接加在單個的html元素標籤上,控制html標籤的表現樣式。這種引入css的方式是分散靈活方便,但缺乏整體性和規劃性,不利於後期的修改和維護,當需要修改 的樣式時,乙個相同的修改可能涉及多個地方,維護成本高。使用style屬性的樣式效果最強,會...
建立執行緒有幾種方式
程式中,我們經常需要使用到執行緒來幫我們做事情,那麼建立執行緒有哪些方式呢?1.繼承 thread 類,並且重寫 run 方法。2.實現 runnable 介面,並且重寫 run 方法。3.實現 callable 介面,並且重寫 call 方法。4.使用 executors 類建立執行緒池。第一種方...
建立執行緒有幾種方式
thread 類本質上是實現了 runnable 介面的乙個例項,代表乙個執行緒的例項。啟動線 程的唯一方法就是通過 thread 類的 start 例項方法。start 方法是乙個 native 方 法,它將啟動乙個新執行緒,並執行 run 方法。如果自己的類已經 extends 另乙個類,就無法...