无法更新文档文件[java]的语言

6ss1mwsb  于 2021-06-29  发布在  Java
关注(0)|答案(0)|浏览(277)

我已经提取了 POIXMLProperties 从我的文档(本地创建的模板)中,我看到language属性带有一个值(系统语言),但我不能将其修改为 POIXMLProperties 不要让你像api文档中描述的那样做。以下是完整代码:

public InputStream updateMetadata(String extension,
                                    InputStream source,
                                    Date created,
                                    String creator,
                                    String language) throws IOException {

File tempFile = File.createTempFile("editor-document", ".tmp");
    try (POIXMLDocument document = getDocument(source, extension);
         FileOutputStream fos = new FileOutputStream(tempFile))
    {
      POIXMLProperties props = document.getProperties();
      POIXMLProperties.CoreProperties coreProps = props.getCoreProperties();
      coreProps.setCreator(creator);
      coreProps.setCreated(metadataFormat.format(created));
      document.write(fos);
    }
}

有什么办法可以改变语言属性吗?

注意,我将doc模板语言设置为none(从doc中的tools>options)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题