Java 如何更新文档中的关键字元数据

Java 如何更新文档中的关键字元数据,java,apache-poi,doc,Java,Apache Poi,Doc,我正在尝试更新文档文件元数据中的关键字。我已经能够用下面的代码更新类别元数据,但是我没有看到任何更改关键字 我正在使用poi:3.10-FINAL void updateProperties(String filepath) { POIFSFileSystem poifs = new POIFSFileSystem(new FileInputStream(filepath)); DirectoryEntry dir = poifs.getRoot();

我正在尝试更新文档文件元数据中的
关键字
。我已经能够用下面的代码更新
类别
元数据,但是我没有看到任何更改
关键字

我正在使用
poi:3.10-FINAL

void updateProperties(String filepath) {
        POIFSFileSystem poifs = new POIFSFileSystem(new FileInputStream(filepath));
        DirectoryEntry dir = poifs.getRoot();
        DocumentSummaryInformation dsi;
        try
        {
            DocumentEntry dsiEntry = (DocumentEntry) dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
            DocumentInputStream dis = new DocumentInputStream(dsiEntry);
            PropertySet ps = new PropertySet(dis);
            dis.close();
            dsi = new DocumentSummaryInformation(ps);
        }
        catch (FileNotFoundException ex)
        {
            dsi = PropertySetFactory.newDocumentSummaryInformation();
        }
        dsi.setCategory("New Category set");


        dsi.write(dir, DocumentSummaryInformation.DEFAULT_STREAM_NAME);
        OutputStream out = new FileOutputStream(filepath);
        poifs.writeFilesystem(out);
        out.close();
    }

关键字不存储在
DocumentSummaryInformation
上,它们存储在另一个属性流
SummaryInformation

如果您查看JavaDocs for,您将看到它有您搜索的方法