2

I'm using Apache POI to generate excel reports. But the properties of the excel file clearly mention that I have used Apache POI. I want to mention my software name instead here

enter image description here

This is my current code, where I'm trying to set a custom property but it's not working.

 XSSFWorkbook xlsxSetMetadata = new XSSFWorkbook();
 xlsxSetMetadata.createSheet("Test sheet");
 POIXMLProperties props = xlsxSetMetadata.getProperties();

 POIXMLProperties.CoreProperties coreProp=props.getCoreProperties();
 coreProp.setCreator("---------------");
 coreProp.setDescription("Report");
 coreProp.setKeywords("Report ");
 coreProp.setTitle("... Report");

 POIXMLProperties.ExtendedProperties extProp=props.getExtendedProperties();
 extProp.getUnderlyingProperties().setCompany("XYX company");
 extProp.getUnderlyingProperties().setTemplate("XSSF");

 POIXMLProperties.CustomProperties custProp = props.getCustomProperties();
 custProp.addProperty("Author", "..........");
 custProp.addProperty("Program name", "MY_SOFTWARE_NAME_HERE");

 String fname = "file_name.xlsx";
 FileOutputStream out = new FileOutputStream(fname);
 xlsxSetMetadata.write(out);
 out.close();

How can I change the program name property to my program name ??

XtremeBaumer
  • 6,275
  • 3
  • 19
  • 65
mrid
  • 5,782
  • 5
  • 28
  • 71

1 Answers1

6

Use

extProp.getUnderlyingProperties().setApplication("MY_SOFTWARE_NAME_HERE");

under the POIXMLProperties.ExtendedProperties.

Taken from this thread

XtremeBaumer
  • 6,275
  • 3
  • 19
  • 65