// Create a new workbook Workbook workbook = new Workbook(); IWorksheet activeSheet = workbook.getActiveSheet(); IRange a1 = activeSheet.getRange("A1"); HashMap dict = new HashMap(); dict.put("TempData1", 1); dict.put("TempData2", "Temp value 2"); dict.put("TempData3", 3); dict.put("TempData4", "Temp value 4"); // Set temporary data to a range a1.setValue(dict); // Display the custom object later HashMap obj = (HashMap)a1.getValue(); int row = 1; for (Map.Entry kv : obj.entrySet()) { activeSheet.getRange("B" + row).setValue(kv.getKey()); activeSheet.getRange("C" + row).setValue(kv.getValue()); row += 1; } // Arrange activeSheet.getColumns().autoFit(); activeSheet.getColumns().get(0).setHidden(true); // Save to a pdf file workbook.save("SetCustomRangeValue.pdf");