Example usage for org.apache.poi.xwpf.model XWPFHeaderFooterPolicy XWPFHeaderFooterPolicy

List of usage examples for org.apache.poi.xwpf.model XWPFHeaderFooterPolicy XWPFHeaderFooterPolicy

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.model XWPFHeaderFooterPolicy XWPFHeaderFooterPolicy.

Prototype

public XWPFHeaderFooterPolicy(XWPFDocument doc) 

Source Link

Document

Figures out the policy for the given document, and creates any header and footer objects as required.

Usage

From source file:avoking.com.documentos.scheduler.startup.Main.java

public static void main(String[] args) {
    //        SplashWindow s = new SplashWindow("E:\\Documentos\\NetBeansProjects\\documentos.scheduler.core\\src\\main\\java\\avoking\\com\\documentos\\scheduler\\startup\\SplashScreen reducida.png", null, 10000);
    //        s.setVisible(true);
    //      //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    try {/*w  w  w. j  a v a2s  .  com*/
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception ex) {
        java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }
    //</editor-fold>  

    try {
        FileInputStream fis = new FileInputStream(
                "E:\\Avo-King\\Documentos\\Desarrollo\\PROCEDIMIENTO_Pruebas_RH\\PDRH-05.docx");
        XWPFDocument xdoc = new XWPFDocument(OPCPackage.open(fis));
        XWPFHeaderFooterPolicy policy = new XWPFHeaderFooterPolicy(xdoc);
        //read header
        XWPFHeader header = policy.getDefaultHeader();
        System.out.println(StringEscapeUtils.escapeJava(header.getText()));
        //            //read footer
        //            XWPFFooter footer = policy.getDefaultFooter();
        //            System.out.println(footer.getText());
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    //        Main m = new Main();
    //        m.execute();
    //        splashLoading.getContentPane().setBackground(Color.WHITE);
    //        splashLoading.pnlProgress.setBackground(Color.WHITE);
    //        splashLoading.setLocationRelativeTo(null);
    //        splashLoading.setVisible(true);
}

From source file:checking_doc.info.java

private static void getKolontitules(String wave) {
    try {/*from w  ww . ja v a  2  s  . c  o  m*/
        FileInputStream fileInputStream = new FileInputStream(wave);
        //    ?  ?   XWPFDocument
        XWPFDocument docxFile = new XWPFDocument(OPCPackage.open(fileInputStream));
        XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy(docxFile);

        // ?   ( )
        XWPFHeader docHeader = headerFooterPolicy.getDefaultHeader();
        HighKolontit = docHeader.getText();
        XWPFFooter docFooter = headerFooterPolicy.getDefaultFooter();
        LowKolontit = docFooter.getText();
        fileInputStream.close();
    } catch (Exception e) {

    }
}