@Test public void test() { try { WordUtil.setDocxProperties("d: } catch (IOException e) { e.printStackTrace(); } }
public static void setDocxProperties(String filename) throws IOException { FileInputStream fis = new FileInputStream(new File(filename)); XWPFDocument doc = new XWPFDocument(fis); POIXMLProperties properties = doc.getProperties(); POIXMLProperties.CoreProperties coreProperties = properties.getCoreProperties(); coreProperties.setCreator("星环信息科技有限公司"); coreProperties.setLastModifiedByUser("星环信息科技有限公司"); POIXMLProperties.ExtendedProperties extendedProperties = properties.getExtendedProperties(); extendedProperties.getUnderlyingProperties().setCompany("星环信息科技有限公司"); FileOutputStream fos = new FileOutputStream(new File(filename)); doc.write(fos); fos.close(); doc.close(); fis.close(); }
WordUtil { public static void setDocxProperties(String filename) throws IOException { FileInputStream fis = new FileInputStream(new File(filename)); XWPFDocument doc = new XWPFDocument(fis); POIXMLProperties properties = doc.getProperties(); POIXMLProperties.CoreProperties coreProperties = properties.getCoreProperties(); coreProperties.setCreator("星环信息科技有限公司"); coreProperties.setLastModifiedByUser("星环信息科技有限公司"); POIXMLProperties.ExtendedProperties extendedProperties = properties.getExtendedProperties(); extendedProperties.getUnderlyingProperties().setCompany("星环信息科技有限公司"); FileOutputStream fos = new FileOutputStream(new File(filename)); doc.write(fos); fos.close(); doc.close(); fis.close(); } }
WordUtil { public static void setDocxProperties(String filename) throws IOException { FileInputStream fis = new FileInputStream(new File(filename)); XWPFDocument doc = new XWPFDocument(fis); POIXMLProperties properties = doc.getProperties(); POIXMLProperties.CoreProperties coreProperties = properties.getCoreProperties(); coreProperties.setCreator("星环信息科技有限公司"); coreProperties.setLastModifiedByUser("星环信息科技有限公司"); POIXMLProperties.ExtendedProperties extendedProperties = properties.getExtendedProperties(); extendedProperties.getUnderlyingProperties().setCompany("星环信息科技有限公司"); FileOutputStream fos = new FileOutputStream(new File(filename)); doc.write(fos); fos.close(); doc.close(); fis.close(); }  }
WordUtil { public static void setDocxProperties(String filename) throws IOException { FileInputStream fis = new FileInputStream(new File(filename)); XWPFDocument doc = new XWPFDocument(fis); POIXMLProperties properties = doc.getProperties(); POIXMLProperties.CoreProperties coreProperties = properties.getCoreProperties(); coreProperties.setCreator("星环信息科技有限公司"); coreProperties.setLastModifiedByUser("星环信息科技有限公司"); POIXMLProperties.ExtendedProperties extendedProperties = properties.getExtendedProperties(); extendedProperties.getUnderlyingProperties().setCompany("星环信息科技有限公司"); FileOutputStream fos = new FileOutputStream(new File(filename)); doc.write(fos); fos.close(); doc.close(); fis.close(); }  static void create(String filename); static void create(String filename, String content); static void createWithBorders(String filename, String content); static void createWithTable(String filename); static void createWithFontStyle(String filename); static void createWithAlign(String filename); static void extractor(String filename); static void setDocxProperties(String filename); static void setDocProperties(String filename); }
WordUtil { public static void setDocxProperties(String filename) throws IOException { FileInputStream fis = new FileInputStream(new File(filename)); XWPFDocument doc = new XWPFDocument(fis); POIXMLProperties properties = doc.getProperties(); POIXMLProperties.CoreProperties coreProperties = properties.getCoreProperties(); coreProperties.setCreator("星环信息科技有限公司"); coreProperties.setLastModifiedByUser("星环信息科技有限公司"); POIXMLProperties.ExtendedProperties extendedProperties = properties.getExtendedProperties(); extendedProperties.getUnderlyingProperties().setCompany("星环信息科技有限公司"); FileOutputStream fos = new FileOutputStream(new File(filename)); doc.write(fos); fos.close(); doc.close(); fis.close(); }  static void create(String filename); static void create(String filename, String content); static void createWithBorders(String filename, String content); static void createWithTable(String filename); static void createWithFontStyle(String filename); static void createWithAlign(String filename); static void extractor(String filename); static void setDocxProperties(String filename); static void setDocProperties(String filename);  }