Can';t文档文件的更新语言[JAVA]
我已经从我的文档(本地创建的模板)中提取了Can';t文档文件的更新语言[JAVA],java,properties,apache-poi,core,document,Java,Properties,Apache Poi,Core,Document,我已经从我的文档(本地创建的模板)中提取了POIXMLProperties,我看到language属性存在一个值(系统语言),但我无法修改它,因为POIXMLProperties不允许您按照。 以下是完整的代码: public InputStream updateMetadata(String extension, InputStream source,
POIXMLProperties
,我看到language属性存在一个值(系统语言),但我无法修改它,因为POIXMLProperties
不允许您按照。
以下是完整的代码:
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);
}
}
有没有办法改变语言属性?
请注意,我将文档模板语言设置为“无”(从文档中的“工具”>“选项”)如果使用Word设置语言,请保存文件,将
.docx
重命名为.zip
并解压缩,zip中的哪个xml文件保存了语言设置?docProps/core.xml
包含以下语言:en GB
Btw该语言设置为系统语言,而不是我在文档中选择的语言!!这并不理想,但我认为,如果您使用Word设置语言,保存文件,将.docx
重命名为.zip
,然后解包,您就可以使用它进行设置,zip中的哪个xml文件保存了语言设置?docProps/core.xml
包含以下语言:en GB
Btw该语言设置为系统语言,而不是我在文档中选择的语言!!这不太理想,但我想你可以通过它到达现场