0
我使用Apache POI將doc轉換爲html。但腳註不會轉換爲html。將doc文件轉換爲html時,doc文件中可用的腳註在html文件/內容中不存在。如何在轉換後堅持這些腳註?Apache POI for doc to html with footnotes
我使用Apache POI將doc轉換爲html。但腳註不會轉換爲html。將doc文件轉換爲html時,doc文件中可用的腳註在html文件/內容中不存在。如何在轉換後堅持這些腳註?Apache POI for doc to html with footnotes
這樣做,我希望它會幫助你..!
public static void readMyDocument(String fileName){
POIFSFileSystem fs = null;
try {
fs = new POIFSFileSystem(new FileInputStream(fileName));
HWPFDocument doc = new HWPFDocument(fs);
/** Read the content **/
readParagraphs(doc);
int pageNumber=1;
/** We will try reading the header for page 1**/
readHeader(doc, pageNumber);
/** we will try reading the footer for page 1**/
readFooter(doc, pageNumber);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void readParagraphs(HWPFDocument doc) throws Exception{
WordExtractor we = new WordExtractor(doc);
/**Get the total number of paragraphs**/
String[] paragraphs = we.getParagraphText();
System.out.println("Total Paragraphs: "+paragraphs.length);
for (int i = 0; i < paragraphs.length; i++) {
System.out.println("Length of paragraph "+(i +1)+": "+ paragraphs[i].length());
System.out.println(paragraphs[i].toString());
}
}
public static void readHeader(HWPFDocument doc, int pageNumber){
HeaderStories headerStore = new HeaderStories(doc);
String header = headerStore.getHeader(pageNumber);
System.out.println("Header Is: "+header);
}
public static void readFooter(HWPFDocument doc, int pageNumber){
HeaderStories headerStore = new HeaderStories(doc);
String footer = headerStore.getFooter(pageNumber);
System.out.println("Footer Is: "+footer);
}
我需要將doc文件轉換爲html並帶註釋 – user1912427