firegloves / MemPOI

A library to simplify export from database to Excel files using Apache POI :japanese_goblin:
MIT License
57 stars 7 forks source link

Apache poi DocumentSummary properties issue #52

Closed wizasp closed 2 years ago

wizasp commented 2 years ago

am facing challenge on exporting hssfworkbook file with custom properties...

my basic target is to change scale and links dirty values as they appear to be null once the file exported

here is my code

HSSFWorkbook workbook = new HSSFWorkbook();

                           // spreadsheet object
                           HSSFSheet spreadsheet = workbook.createSheet("Sheet1");

                           // creating a row object
                           HSSFRow row;

                           // This data needs to be written (Object[])
                           Map<String, Object[]> studentData = new TreeMap<String, Object[]>();

                         //Amend Captured Data
                           Integer Line = 1;
                            while((line = br.readLine()) != null){

                                    String[] values = line.split(",");

                                    studentData.put(Line.toString(), new Object[] { values[6],tp.get_conf_data()[4], values[5],
                                            values[1], values[2], tp.get_conf_data()[6], tp.get_conf_data()[5], values[4], 
                                            sysdate_txn, values[3]
                                    });
                                    Line ++;

                            }
                            br.close();

                           Set<String> keyid = studentData.keySet();

                           int rowid = 0;

                           // writing the data into the sheets...

                           for (String key : keyid) {

                               row = spreadsheet.createRow(rowid++);
                               Object[] objectArr = studentData.get(key);
                               short cellid = 0;

                               for (Object obj : objectArr) {
                                   HSSFCell cell = row.createCell(cellid++);
                                   cell.setCellValue((String)obj);
                               }
                           }

                           // writing the workbook into the file...
                           File outfile = new File(path_xls_directory+"\\"+sysdate_logs+"_"+file.getName()+".xls");
                           FileOutputStream out = new FileOutputStream(outfile);

                           workbook.write(out);
firegloves commented 2 years ago

Hello @wizasp

this doesn't look like MemPOI code. It seems to me that it is plain Apache POI. If this is the case, please post your question on the right channel (Stackoverflow, Apache POI github handle, etc).

Otherwise, please add the code relative to MemPOI and I will be glad to help you.