无法使用Apache POI设置作者和标题
我能够得到并设置作者和标题名称,但无法在输出文件中看到它。 当我通过点击右键和我的输出文件来查看详细信息时,它具有旧的作者和标题名称。 请帮帮我..
我正在使用poi apache api for excel文件。
以下是我的代码示例:
public void processPOIFSReaderEvent(POIFSReaderEvent event) { SummaryInformation si = null; si = (SummaryInformation) PropertySetFactory.create(event.getStream()); si.setTitle(title); si.setAuthor("Author Name"); }
可能你需要写回你的改变。
在这里检查示例
尝试这个:
HSSF:
SummaryInformation summaryInfo = workbook.getSummaryInformation(); summaryInfo.setAuthor(author);
XSSF:
POIXMLProperties xmlProps = workbook.getProperties(); POIXMLProperties.CoreProperties coreProps = xmlProps.getCoreProperties(); coreProps.setCreator(author);